Computing.Net > Forums > Unix > extracting few characters from file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

extracting few characters from file

Reply to Message Icon

Name: trichyselva
Date: January 1, 2008 at 23:08:09 Pacific
OS: windows xp
CPU/Ram: p4
Product: pentium
Comment:

i want to extract few characters from a flat file using special character || as field separator
how to do it
suggestions please



Sponsored Link
Ads by Google

Response Number 1
Name: James Boothe
Date: January 3, 2008 at 07:51:50 Pacific
Reply:

Here is a file with columns delimited by double bar characters:

aaa||bbbbb||cc
xxx||Happy New Year||yyyyy

The following code will locate lines having "xxx" in column 1, and will print column 2 from each of those lines:

awk -F"[|][|]" '$1=="xxx" {print $2}' infile

Happy New Year


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: extracting few characters from file

Removing characters from file names www.computing.net/answers/unix/removing-characters-from-file-names/4910.html

Extracting particular fields from a file www.computing.net/answers/unix/extracting-particular-fields-from-a-file/3239.html

Need help extracting data from file www.computing.net/answers/unix/need-help-extracting-data-from-file/7836.html