The UNIX and Linux Forums  
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




Thread: grep question
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-04-2007
tim-bobby tim-bobby is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 2
grep question

I wanted to search a for all lines containing ERROR but not errors that contained the word "foo" (for example). The only way I could figure out to do it was:

grep ERROR myfile.log | grep -v foo

is there a way to do this with one grep command instead of two? One grep is faster than two, especially for large files like log files.