![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Storing space delimited line in var with loop? | eltinator | Shell Programming and Scripting | 2 | 08-24-2007 02:09 AM |
| Parsing line out of a file, please help !! | xeniya | Shell Programming and Scripting | 5 | 05-31-2007 12:52 PM |
| Parsing comma delimited text file | chengwei | Shell Programming and Scripting | 5 | 02-23-2007 05:38 AM |
| Problem parsing line in file | rlwilli | Shell Programming and Scripting | 2 | 09-02-2006 12:15 PM |
| command line argument parsing | rmjoe | UNIX for Dummies Questions & Answers | 1 | 07-28-2005 04:39 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I have a text file of lines like: A=5|B=7|G=4|C=3|P=4|... In other words, each line is a pipe-delimited set of pairs of strings of the form "X=Y". What I want to do is find the token starting with "C", and print it and its value (so I'd want to print "C=3" in the example above). I'm pretty new to sed, awk, etc. - so any help is appreciated. Note that you do not know which position the "C" string is in. If we did (assuming it was the 13th token), I'd use: Code:
awk -F "|" '{print $13}'
But since it can be in different locations in different lines, this won't work. Thanks in advance - this is my first post, by the way. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|