The UNIX and Linux Forums  


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 -->
  #6 (permalink)  
Old 04-26-2007
wannalearn wannalearn is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 33
If i do this
cut -d"/" -f5 | egrep -e "p2"
it will be grepping on the output because we are using the pipe....

grep pattern a.log|grep -e "p1" |cut -d":" -f1,2,3,4,8,9,10|cut -d"/" -f5 -e "p2" |cut -d":" -f1,2,3,4,6|cut -d"/" -f5 >> file

So i used the grep -e


I want to search for pattern one do the cutting part then search for pattern two and do the cutting part for that in the same log instead of grepping two times

grep pattern a.log|grep "p1" |cut -d":" -f1,2,3,4,8,9,10|cut -d"/" -f5
grep pattern a.log|grep "p2" |cut -d":" -f1,2,3,4,6|cut -d"/" -f5

i have to execute the above command by using grep only once :-)