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 > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 04-21-2008
varungupta varungupta is offline
Registered User
  
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 206
Quote:
Originally Posted by shalua View Post
Just want to make my question more clear. I want to check if all 3 lines exist or not, meaning an AND condition.

Thanks!!
Solution:
Check with grep -e "searchText1" -e "SearchText2" <FILENAME>

This makes the multiple search possible.

With AND caluse you can use sed option to search.
As :
sed '/pattern/action' filename

for multiple searchs use..
sed -e 'pattern1/p' -e '/pattern2/p' -e '/pattern3/p' FILE

Hope this'll work for you !!
Thanks.