Subject: Is it possible to reorder fields with cut?

From: Peng Yu <[email-masked]>
Date: Thu, 10 Jun 2010 11:58:00 -0500

Hi,

I need to reorder the fields in a file. But the -f option can not be
used to reorder field 1 and field 2.

Basically, I want the original 1st field as the new 2nd field and the
original 2nd field the first. Is reordering fields possible with cut.

$ cat input.txt
a	b	c
e	f	g
$ cut -f 1,2 input.txt
a	b
e	f
$ cut -f 2,1 input.txt
a	b
e	f

-- 
Regards,
Peng