The UNIX and Linux Forums  

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 here.

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-17-2005
Registered User
 

Join Date: Aug 2005
Posts: 64
Awk??

Hello all, I have a most complex problem.

I have a file with many entries of the format :

option1|option2|nonsense|rubbish:unuseful_data [option3]: useless_info=[option4]


My question is: Is it possible to pick out options 1-4 into a single file for further processing?

Thanks
Khoom
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-17-2005
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,243
awk -F '[\\|\\[\\]]' '{print $1,$2,$5,$7}'
Reply With Quote
  #3 (permalink)  
Old 10-17-2005
Registered User
 

Join Date: May 2005
Posts: 46
Didnt get that

Hi

Can you plz explain how is it working.

Reply With Quote
  #4 (permalink)  
Old 10-17-2005
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,243
FS is the input field separator (see Specifying how Fields are Separated ). The value is a single-character string or a multi-character regular expression that matches the separations between fields in an input record.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0