up vote 4 down vote favorite
share [g+] share [fb]

The following command lists all files (with lines) that have the mentioned line:

$ grep  "\[oow\] running" *.log

However, what I want to know is all the *.log files that do not have that line. Using the -v option to grep prints innumerous number of other lines. But I only want the file that does not have the mentioned line. How does one normally do this in Unix/Mac (in command line of course)?

link|improve this question

60% accept rate
feedback

2 Answers

up vote 9 down vote accepted

Use the -L 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.
link|improve this answer
feedback
$ grep -L "\[oow\] running" *.log
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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