GNU bug report logs - #6394
Is it possible to reorder fields with cut?

Previous Next

Package: coreutils;

Reported by: Peng Yu <pengyu.ut <at> gmail.com>

Date: Thu, 10 Jun 2010 16:59:02 UTC

Severity: normal

Tags: notabug

Merged with 9507, 13301

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 6394 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Peng Yu <pengyu.ut <at> gmail.com>
Cc: 6394 <at> debbugs.gnu.org
Subject: Re: bug#6394: Is it possible to reorder fields with cut?
Date: Thu, 10 Jun 2010 11:44:29 -0600
[Message part 1 (text/plain, inline)]
On 06/10/2010 10:58 AM, Peng Yu wrote:
> 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.

Correct.  POSIX standardized this behavior because some scripts rely on
it, even though it may not be the most intuitive.

> 
> 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.

No.  Use awk instead.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 12 years and 131 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.