unix – grep -l和grep -ln
发布时间:2020-12-15 21:45:15 所属栏目:安全 来源:网络整理
导读:根据grep手册, -l,--files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. grep -l,这似乎很好,因为当找到匹配时,回显
根据grep手册,
-l,--files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. grep -l,这似乎很好,因为当找到匹配时,回显包含匹配的文件名. 但是,当我执行grep -ln时,grep会回显该事件的每一行. grep -l是否真的意味着在找到第一次匹配时停止并停止扫描,而grep -ln将忽略-l标志? 解决方法
这些选项不兼容.如果要在每个文件中显示第一个匹配(以及仅第一个匹配)的行号,请使用grep -Hnm 1.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |