How to find text files not containing text on Linux?

How do I find files not containing some text on Linux? Basically I'm looking for the inverse of the following

find . -print | xargs grep -iL "somestring"

The command you quote, ironically enough does exactly what you describe. Test it!

echo "hello" > a
echo "bye" > b
grep -iL BYE a b

Says a only.


I think you may be confusing -L and -l

find . -print | xargs grep -iL "somestring"

is the inverse of

find . -print | xargs grep -il "somestring"

By the way, consider

find . -print0 | xargs -0 grep -iL "somestring"

Or even

grep -IRiL "somestring" .
链接地址: http://www.djcxy.com/p/2202.html

上一篇: 什么时候阻止,为什么?

下一篇: 如何在Linux上查找不包含文本的文本文件?