![]() |
|
|
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 |
| Help me with parsing this file | eamani_sun | Shell Programming and Scripting | 2 | 05-16-2008 04:39 PM |
| Parsing xml file using Sed | kapilkinha | UNIX for Advanced & Expert Users | 3 | 04-08-2008 10:43 AM |
| Parsing a csv file | chiru_h | Shell Programming and Scripting | 6 | 02-12-2008 09:33 AM |
| File Parsing | jsusheel | Shell Programming and Scripting | 5 | 09-25-2007 11:25 AM |
| parsing file through awk | bbeugie | Shell Programming and Scripting | 13 | 08-22-2006 02:21 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
awk and file parsing
Hi, I have a input file like this
TH2TH2867Y NOW33332106Yo You Baby TH2TH3867Y NOW33332106No Way Out TH2TH9867Y NOW33332106Can't find it TJ2TJ2872N WOW33332017sure thing alas TJ2TJ3872N WOW33332017the sky rocks TJ2TJ4872N WOW33332017nothing else matters TJ2TJ5872N WOW33332017you know about it TJ2TJ6872N WOW33331999nothing else matters TJ2TJ7872N WOW33332017nothing else matters TJ2TJ8872N WOW33332017No Way Out TJ2TAW872N WOW33331999No Way Out TJAPXC050Y NOW33331999No Way Out. TJAT1N999Y NOW33331999still loving you. TJBJOG575Y NOW33331999Jacka nd jill. TJBJXG575Y NOW33331999Julie and friend I am trying to get the output something like this- Yo You Baby|TH2 No Way Out|TJ2 still loving you.|TJA You got it|TJB Here..TH2,TJ2,TJA and TJB are the distinct first 3 characters from the input. In the input , lets say fr=substr($0,1,3) and nx=substr($0,4,3). Basically, i want to check the line if the first 3 character(fr) = the next 3 characters(nx), then print substr($0,23,20) and the substr($0,1,3) If they dont match, then print the first occurance of the fr with the substr($0,23,20). Help! Regards, Big Gun |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|