![]() |
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 |
| Changing one column of delimited file column to fixed width column | manneni prakash | Shell Programming and Scripting | 5 | 06-22-2009 05:27 AM |
| How to get the first column from the txt file using unix command? | psiva_arul | Shell Programming and Scripting | 4 | 01-08-2009 10:36 AM |
| Trim String in 3rd Column in Tab Delimited File...SED/PERL/AWK? | rickdini | UNIX for Dummies Questions & Answers | 6 | 09-29-2008 02:35 AM |
| trim file | tungaw2004 | UNIX for Dummies Questions & Answers | 1 | 09-15-2007 06:05 AM |
| trim leading zero in certain column in a string | dngo | UNIX for Dummies Questions & Answers | 2 | 04-01-2007 02:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How to trim a 419th column in UNIX file.
Hi All,
I have a UNIX file, which has Total of 532 column, each delimited with ^~^. One of the column (419) is 202 character long. In real case, it should be 22 character long. cut -d~ -f419 filename ^404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040402 D2D404D4450444040604048E040404240C0404040 42404040404040584042544040404044404040404040404040404040404040^ I need to trim it to 22 character. at the begining & end ^ sould come. I have searched & found following link. Trim String in 3rd Column in Tab Delimited File...SED/PERL/AWK? But when i execute the command given here, AWK is not supporting it. Can some one help me? |
|
||||
|
It gives following error.
$ awk 'NR==1{print;next}{$419=substr($419,180)}1' ABC20090112.OUT > aaa awk: trying to access field 419 all record(columns) are delimited with ^~^ & there are 532 columns. From my data file i want to trim 419th column from 202 characters to 22 characters , so that i can load it. |
|
||||
|
It gives same error.
$ awk -F~ 'NR==1{print;next}{$419=substr($419,180)}1' ABC20090112.OUT > aaa awk: trying to access field 419 or $ awk -F^~^ 'NR==1{print;next}{$419=substr($419,180)}1' ABC20090112.OUT > aaa awk: trying to access field 419 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| awk, awk trim, trim, trim awk, trimming |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|