
04-26-2007
|
|
Registered User
|
|
|
Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
|
|
|
Quote:
|
Originally Posted by wannalearn
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 :-)
|
You can grep patterns "p1" and "p2" using egrep. But you need different fields for line containing patterns "p1" and "p2". So you cannot do all in one command.
Can you show your input?
|