GNU bug report logs -
#9507
cut bug?
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9507 in the body.
You can then email your comments to 9507 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#9507
; Package
coreutils
.
(Wed, 14 Sep 2011 16:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
James Heather <j.heather <at> surrey.ac.uk>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 14 Sep 2011 16:44:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
I'm sure this must have been spotted before, but
cut -f2,1
produces the fields in the order 1,2 rather than 2,1. That seems wrong
to me.
Changing it would probably break a thousand scripts. But could we have
an additional option to respect the order of fields given on the command
line? It is a pain to rearrange fields with sed, though of course it can
be done.
Thanks, and keep up the good work.
James
[Message part 2 (text/html, inline)]
Reply sent
to
Eric Blake <eblake <at> redhat.com>
:
You have taken responsibility.
(Wed, 14 Sep 2011 16:58:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
James Heather <j.heather <at> surrey.ac.uk>
:
bug acknowledged by developer.
(Wed, 14 Sep 2011 16:58:01 GMT)
Full text and
rfc822 format available.
Message #10 received at 9507-done <at> debbugs.gnu.org (full text, mbox):
tag 9507 notabug
merge 6394 9507
thanks
On 09/14/2011 10:20 AM, James Heather wrote:
> Hi,
>
> I'm sure this must have been spotted before, but
>
> cut -f2,1
>
> produces the fields in the order 1,2 rather than 2,1. That seems wrong
> to me.
You're not the first to complain of this, and probably won't be the last.
>
> Changing it would probably break a thousand scripts.
Yep. And it would also violate POSIX, so changing it now is a
non-starter. For reference, here's the POSIX text:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html
"The elements in list can be repeated, can overlap, and can be specified
in any order, but the bytes, characters, or fields selected shall be
written in the order of the input data."
"The list option-arguments are historically used to select the portions
of the line to be written, but do not affect the order of the data. For
example:
echo abcdefghi | cut -c6,2,4-7,1
yields "abdefg"."
> But could we have
> an additional option to respect the order of fields given on the command
> line?
Why? It's already portable to use awk:
awk '{print $2,$1}'
https://lists.gnu.org/archive/html/bug-coreutils/2007-09/msg00169.html
at which point, you have the choice between a POSIX-mandated solution
already on your system, even if you don't use coreutils; or waiting for
a coreutils extension to be written and propagate to your distro, and
which still won't work on other platforms like BSD. You can tell which
way we are leaning.
> It is a pain to rearrange fields with sed, though of course it can
> be done.
awk is better than sed for this task.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Added tag(s) notabug.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Tue, 20 Sep 2011 18:01:01 GMT)
Full text and
rfc822 format available.
Forcibly Merged 6394 9507.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Tue, 20 Sep 2011 18:03:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 19 Oct 2011 11:24:03 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Mon, 14 Jan 2013 02:10:02 GMT)
Full text and
rfc822 format available.
Forcibly Merged 6394 9507 13301.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Mon, 14 Jan 2013 02:10:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 11 Feb 2013 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.