I need to be able to search a directory for all files that do not contain a certain word. My issue with my approaches so far is that they return every line of every file that does not contain the word. I just need a list of files that don't contain it.

Is there a program that does this? I prefer windows, but I also can use linux commands if you have one. I thought about grep -v, but this ends up printing out every lien of every file in a large directory (since most lines do not contain the phrase). I just need the file names (but contents searched).




grep -rIL searchword

According to the Manual:

-R, -r, --recursive

Read all files under each directory, recursively; this is equivalent to the -d recurse option.

-L, --files-without-match

Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match.


Process a binary file as if it did not contain matching data; this is equivalent to the --binary-files=without-match option.

  • Thank you, this does the trick. I had to do a more complicated command, but -L is the magic here. – Dan M Feb 27 '16 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.