Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)?

share|improve this question
up vote 10 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.
share|improve this answer
$ grep -L "\[oow\] running" *.log
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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