Hi everyone,
Please some help over here. (I�m using cygwing)
I have files with 40 columns and 2000 lines in average. I�m trying to change the order position as follow.
Original columns position:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40
Desired columns position:
1,10,21,5,9,7,32,18,20,37,15,2,3,4,6,8,11,12,13,14,16,17,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,38,39,40
I was trying using the follow awk script:
awk -F"," '{print $1,$10,$21,$5,$9,$7,$32,$18,$20,$37,$15,$2,$3,$4,$6,$8,$11,$12,$13,$14,$16,$17,$19,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$33,$34,$35,$36,$38,$39,$40'}' infile
but doesn�t work only if I reduce the script to the first 11 columns, as follow:
awk -F"," '{print $1,$10,$21,$5,$9,$7,$32,$18,$20,$37,$15}' infile
Somebody knows what is wrong with my script?
How can be a best way to change all 40 columns position?
Thanks in advance for any help.
Regards.