I have a file named ip-list with two columns:
ip-list
IP1 Server1 IP2 Server2
And I want to produce:
More than two columns
printf "\ 1 2 3 4 5 6 7 8 " | awk '{for(i=NF;i>0;i--)printf "%s ",$i;print ""}'
Output:
4 3 2 1 8 7 6 5
See also: https://unix.stackexchange.com/questions/46275/swapping-an-unlimited-number-of-columns
Tested in GNU Awk 4.0.1.