in reply to Better method to cut columns from delimited file
You're in one-liner terrritory, but the syntax can be a bit tricky. The quotes and backslash in -F"\|" are both required (at least on a windows shell):
C:\test>copy con junk.csv NAME|AGE|CITY|ZIP AAA|23|STAT|60001 BBB|34|PPOR|12345 CCC|11|TRET|2345 ^Z 1 file(s) copied. C:\test>perl -F"\|" -anle"print join'|', @F[ 0,2 ]" junk.csv NAME|CITY AAA|STAT BBB|PPOR CCC|TRET
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Better method to cut columns from delimited file
by stevieb (Canon) on May 10, 2012 at 04:56 UTC | |
by NetWallah (Canon) on May 10, 2012 at 05:21 UTC | |
by BrowserUk (Patriarch) on May 10, 2012 at 05:33 UTC |