-7

How to switch columns 5 and 6 in a file in Linux?

I data samples as follows:

R950E03 111006 930226 910008 Resistant 1

R950E06 110917 950085 910043 Resistant 2

R950C09 110892 950085 910125 Resistant 2

R949B05 111101 870141 840409 Resistant 2

Cœur
  • 37,241
  • 25
  • 195
  • 267

2 Answers2

1

You can use awk.

awk '{print $1, $2, $3, $4, $6, $5}' yourfile > tmp
mv tmp yourfile
liboyue
  • 11
  • 1
0

Use cut instead of awk if you want

Refer to

https://stackoverflow.com/a/11967934/7188414

Regards