- or download this
C:\test>perl -F"\|" -anle"print join'|', @F[ 1,3, 0,2 ]" junk.csv
AGE|ZIP|NAME|CITY
23|60001|AAA|STAT
34|12345|BBB|PPOR
11|2345|CCC|TRET
- or download this
C:\test>perl -F"\|" -anle"$n=0;if($.==1){ %names=map{$_,$n++}@F;next};
+ print join'|', @F[@names{'AGE','NAME'}]" junk.csv
23|AAA
34|BBB
11|CCC
- or download this
#! perl -slw
use strict;
...
23|AAA
34|BBB
11|CCC