使用grep进行负面匹配(匹配不包含foo的行) [英] Negative matching using grep (match lines that do not contain foo)
本文介绍了使用grep进行负面匹配(匹配不包含foo的行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在努力研究这个命令的语法:
I have been trying to work out the syntax for this command:
grep ! error_log | find /home/foo/public_html/ -mmin -60
或
or
grep '[^error_log]' | find /home/baumerf/public_html/ -mmin -60
我需要查看所有已经存在的文件除了那些名为 error_log
。
I need to see all files that have been modified except for those named error_log
.
我已经在这里阅读过了,但只发现了一个不是
-regex模式。
I've read about it here, but only found one not
-regex pattern.
推荐答案
grep --help | grep invert
-v,--invert-match select不匹配行
-v, --invert-match select non-matching lines
同时检查相关的 -L
$ b
Also check out the related -L
(the complement of -l
).
-L, - 文件不带匹配只打印文件
-l </ code>不包含匹配的名称
-L, --files-without-match only print FILE names containing no match
这篇关于使用grep进行负面匹配(匹配不包含foo的行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文