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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Count not correct popeye Shell Programming and Scripting 3 04-22-2008 12:50 PM
Is the script correct ??? jaganadh Shell Programming and Scripting 0 12-13-2007 04:50 AM
Tar-ing the correct directories new2ss UNIX for Dummies Questions & Answers 1 11-08-2007 10:15 PM
Correct the error plz Mandab Shell Programming and Scripting 2 05-11-2007 01:15 PM
to get the correct value with unsigned int naan High Level Programming 2 04-11-2007 06:29 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-26-2007
anbu23 anbu23 is offline Forum Advisor  
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?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0