The UNIX and Linux Forums  
Hello and Welcome from United States 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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-22-2008
pb18798 pb18798 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 18
Thumbs up search multiple words using grep

Hi frnds

i want to desplay file names that should be word1 and word2

ex :

i have 10 *.log files

5 files having word1 and word2
5 files having only word1,

i have used below command

egrep -l 'word1|word2' *.log

its giving all 10 files, but i want to display only 5 files having both words