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 01: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 02:15 PM
to get the correct value with unsigned int naan High Level Programming 2 04-11-2007 07: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
wannalearn wannalearn is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 33
plz correct this

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

Dont know why the above command isnt working :-(

can someone correct me...
  #2 (permalink)  
Old 04-26-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,538
the best is to give a sample of that a.log file, and your desired output format.
  #3 (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
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

Dont know why the above command isnt working :-(

can someone correct me...
Remove -e "p2"
Code:
cut -d"/" -f5 -e "p2" 
  #4 (permalink)  
Old 04-26-2007
wannalearn wannalearn is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 33
well

well i need that -e there as i wanna search for another pattern....do u think i need to use braces anywhere?
  #5 (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
well i need that -e there as i wanna search for another pattern....do u think i need to use braces anywhere?
Change
Code:
cut -d"/" -f5 -e "p2"
to
Code:
cut -d"/" -f5 | egrep  -e "p2"
You cannot search for a pattern in cut command
  #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 :-)
  #7 (permalink)  
Old 04-26-2007
wannalearn wannalearn is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 33
hmmm..

Sorry by using grep thrice totally not four times :-)
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 07:03 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