Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I have a very annoying message being output from a process I'm running. I'd rather not remove the line, but simply remove it with grep

The messages to ignore all contain the word "requests". I could easily ONLY these lines with

$> myproc | grep requests

How would I make grep instead IGNORE lines with the word requests?

share|improve this question
up vote 7 down vote accepted

Just use the -v option:

myproc | grep -v requests

share|improve this answer
Oh wow. That is too easy. Thanks so much! :-) I'll accept when it lets me. – corsiKa Apr 16 '11 at 6:31

Sorry can't resist:

myproc | perl -ne "/requests/ or print"

that's a perl one liner that uses -e to execute code on the command line, and -n to wrap it in a while loop reading one line at a time. The /requests/ part is a match against any line that contains the word 'requests`. Putting it all together says, "if the line doesn't contain the word 'requests', print it out."

This is a contrived example since Robin Green points out that grep -v works just fine in your case. However you can extend this perl one liner to make an arbitrarily complex filter.

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.