So I have a file with 2 columns as follows:
10 1
11 2
12 3
13 4
14 5
I would like to switch the columns using the cut command. I've used
paste <(cut -f2 file.dat) <(cut -f1 file.dat)
And it's giving me the following:
10 1 10 1
11 2 11 2
12 3 12 3
13 4 13 4
14 5 14 5
Anyone know how I could use cut
and paste
to switch the columns? I thought the cut -f1
or cut -f2
would cut each field but apparently not? What am I doing wrong here?
UPDATE:
So I'm using -d
instead of f
and it's giving me weird results and yet when I cat
the file, the contents remain unchanged?
cut -f2 file.txt
?