![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| extraction of last but one char | hidnana | Shell Programming and Scripting | 5 | 02-14-2008 08:22 AM |
| AWK extraction | harris2107 | Shell Programming and Scripting | 3 | 08-17-2007 06:02 AM |
| Help with tar extraction! | manthasirisha | Shell Programming and Scripting | 4 | 03-17-2006 07:17 AM |
| extraction from a tape | big123456 | UNIX for Advanced & Expert Users | 4 | 10-25-2005 05:34 AM |
| help on file extraction | apalex | UNIX for Dummies Questions & Answers | 1 | 05-01-2001 11:29 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
AWK extraction
Hi all,
I have a data file from which i would like to extract only certain fields, which are not adjacent to each other. Following is the format of data file (data.txt) that i have, which has about 6 fields delimited by "|" HARRIS|23|IT|PROGRAMMER|CHICAGO|EMP JOHN|35|IT|JAVA|NY|CON CHRIS|45|HR|ACCOUNT|NJ|EMP JUDY|32|HR|RECRUIT||EMP As you can see, there are 6 fields delimited by "|". All i want from this file are the 1,3,5,6 fields separated by the "|" delimiter. So, after extraction, i would like the file to look as HARRIS|IT|CHICAGO|EMP JOHN|IT|NY|CON CHRIS|HR|NJ|EMP JUDY|HR||EMP How can i do this using AWK? or which ever utility that would help to achieve this? Remember there can be a null value in the field as could be seen in the last line of the file. Any help would be greatly appreciated. Thanks, Harris. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|