Use the -L flag to list the files that does not contain the search term.
Let’s return back to our simple test.txt file with the following content:
sad
happy
awake
coffee
work
schoolLet’s also create a file numbers.txt with different content:
$ echo 123456789 > numbers.txtIn order to see which file does not contain the numbers, run:
$ grep -L 12345 *
test.txtWant to see the files that do contain the numbers? Use the -l flag:
$ grep -l 12345 *
numbers.txt