I have a file with columns. See below for an example:
a b c ... z
1 2 3 ... 26
I'd like to swap all columns where the 1st becomes the last, the second becomes the one before last…etc..
z y x ... a
26 25 24 ... 1
Is there a one liner (awk
or sed
) that does this?
I know one can use awk
when there is only a couple columns,
but I'd like to be able to do this on files with thousands of columns.
tac
does this perfectly for lines.
I guess I am looking for the equivalent for columns.
rev
hasn't worked for me, as it also swaps content in the column.
Best Answer