Sample Header Ad - 728x90

How to reorder a large number of columns?

5 votes
4 answers
5740 views
I'm looking for a pipeable one-liner to reorder a large number of columns (where manually entering the column numbers in e.g. an awk command such as awk '{print $3,$2,$1}' is not feasible). The order could be given by a sorting scheme (alphabetical, numerical - so like 'sort' but acting on columns rather than rows.) or be arbitrarily given in a text file.
Asked by gaffa (51 rep)
Apr 17, 2012, 08:36 AM
Last activity: Feb 23, 2024, 01:05 PM