How do I find files that do not contain a given string pattern?

如何找出当前目录中包含单词foo (使用grep )的文件?


如果你的grep有-L (或--files-without-match )选项:

$ grep -L "foo" *

Take a look at ack . It does the .svn exclusion for you automatically, gives you Perl regular expressions, and is a simple download of a single Perl program.

The equivalent of what you're looking for should be, in ack :

ack -L foo

以下命令给我所有不包含模式foo的文件:

find .  -not  -ipath '.*svn*' -exec  grep  -H -E -o -c  "foo"  {} ; | grep 0
链接地址: http://www.djcxy.com/p/2194.html

上一篇: 如何在Linux中符号链接文件?

下一篇: 如何查找不包含给定字符串模式的文件?