From unknown Sun Aug 10 11:48:53 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#9507 <9507@debbugs.gnu.org> To: bug#9507 <9507@debbugs.gnu.org> Subject: Status: cut bug? Reply-To: bug#9507 <9507@debbugs.gnu.org> Date: Sun, 10 Aug 2025 18:48:53 +0000 retitle 9507 cut bug? reassign 9507 coreutils submitter 9507 James Heather severity 9507 normal tag 9507 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 14 12:43:50 2011 Received: (at submit) by debbugs.gnu.org; 14 Sep 2011 16:43:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3sYv-0003VA-Bh for submit@debbugs.gnu.org; Wed, 14 Sep 2011 12:43:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3sGu-0002FV-A7 for submit@debbugs.gnu.org; Wed, 14 Sep 2011 12:25:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3sCU-00033J-89 for submit@debbugs.gnu.org; Wed, 14 Sep 2011 12:20:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:60092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3sCU-00033F-6k for submit@debbugs.gnu.org; Wed, 14 Sep 2011 12:20:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3sCQ-0001Oq-4A for bug-coreutils@gnu.org; Wed, 14 Sep 2011 12:20:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3sCM-0002zn-8N for bug-coreutils@gnu.org; Wed, 14 Sep 2011 12:20:34 -0400 Received: from mail1.bemta3.messagelabs.com ([195.245.230.34]:40238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3sCM-0002wL-3v for bug-coreutils@gnu.org; Wed, 14 Sep 2011 12:20:30 -0400 Received: from [195.245.230.131:20151] by server-7.bemta-3.messagelabs.com id CE/BA-29249-B44D07E4; Wed, 14 Sep 2011 16:20:27 +0000 X-Env-Sender: J.Heather@surrey.ac.uk X-Msg-Ref: server-12.tower-78.messagelabs.com!1316017226!74331045!8 X-Originating-IP: [131.227.200.43] X-StarScan-Version: 6.3.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18611 invoked from network); 14 Sep 2011 16:20:27 -0000 Received: from unknown (HELO EXHT022P.surrey.ac.uk) (131.227.200.43) by server-12.tower-78.messagelabs.com with AES128-SHA encrypted SMTP; 14 Sep 2011 16:20:27 -0000 Received: from [192.168.146.51] (131.227.200.4) by EXHT022P.surrey.ac.uk (131.227.200.43) with Microsoft SMTP Server (TLS) id 8.1.393.1; Wed, 14 Sep 2011 17:20:22 +0100 Subject: cut bug? From: James Heather To: Date: Wed, 14 Sep 2011 17:20:20 +0100 Content-Type: multipart/alternative; boundary="=-Ujc+t1Tt6+ukNzcdJbsJ" X-Mailer: Evolution 3.0.3 (3.0.3-1.fc15) Message-ID: <1316017222.29307.52.camel@oscar.bluehouse.dyndns.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 14 Sep 2011 12:43:48 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) --=-Ujc+t1Tt6+ukNzcdJbsJ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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 --=-Ujc+t1Tt6+ukNzcdJbsJ Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit 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 --=-Ujc+t1Tt6+ukNzcdJbsJ-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 14 12:57:25 2011 Received: (at 9507-done) by debbugs.gnu.org; 14 Sep 2011 16:57:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3sm4-0004be-OW for submit@debbugs.gnu.org; Wed, 14 Sep 2011 12:57:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3sm0-0004bV-UY for 9507-done@debbugs.gnu.org; Wed, 14 Sep 2011 12:57:22 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8EGqkuB020767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 Sep 2011 12:52:46 -0400 Received: from [10.3.113.73] (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8EGqkj6029572; Wed, 14 Sep 2011 12:52:46 -0400 Message-ID: <4E70DBDD.2070301@redhat.com> Date: Wed, 14 Sep 2011 10:52:45 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110831 Fedora/3.1.12-2.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.12 MIME-Version: 1.0 To: James Heather Subject: Re: bug#9507: cut bug? References: <1316017222.29307.52.camel@oscar.bluehouse.dyndns.org> In-Reply-To: <1316017222.29307.52.camel@oscar.bluehouse.dyndns.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -10.3 (----------) X-Debbugs-Envelope-To: 9507-done Cc: 9507-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.3 (----------) 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@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 20 14:00:18 2011 Received: (at control) by debbugs.gnu.org; 20 Sep 2011 18:00:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R64cE-0001Nm-1X for submit@debbugs.gnu.org; Tue, 20 Sep 2011 14:00:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R64cA-0001HV-6g for control@debbugs.gnu.org; Tue, 20 Sep 2011 14:00:16 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8KHt5Ml011230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Sep 2011 13:55:05 -0400 Received: from [10.3.113.135] (ovpn-113-135.phx2.redhat.com [10.3.113.135]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8KHt4iN031217 for ; Tue, 20 Sep 2011 13:55:05 -0400 Message-ID: <4E78D378.3060907@redhat.com> Date: Tue, 20 Sep 2011 11:55:04 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.22) Gecko/20110906 Fedora/3.1.14-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.14 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: more work Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -10.3 (----------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.3 (----------) tag 9507 notabug forcemerge 6394 9507 tag 9504 notabug tag 9449 notabug tag 9450 wishlist tag 9418 notabug tag 9380 notabug tag 9327 notabug tag 9326 notabug tag 9283 notabug tag 9281 notabug thanks -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 20 14:02:48 2011 Received: (at control) by debbugs.gnu.org; 20 Sep 2011 18:02:49 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R64eb-0001p9-T6 for submit@debbugs.gnu.org; Tue, 20 Sep 2011 14:02:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R64eZ-0001oz-G0 for control@debbugs.gnu.org; Tue, 20 Sep 2011 14:02:44 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8KHvYbC030356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Sep 2011 13:57:35 -0400 Received: from [10.3.113.135] (ovpn-113-135.phx2.redhat.com [10.3.113.135]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8KHvYB7029741 for ; Tue, 20 Sep 2011 13:57:34 -0400 Message-ID: <4E78D40E.9060006@redhat.com> Date: Tue, 20 Sep 2011 11:57:34 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.22) Gecko/20110906 Fedora/3.1.14-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.14 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: another try Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Spam-Score: -10.3 (----------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.3 (----------) unarchive 6394 forcemerge 6394 9507 thanks -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From unknown Sun Aug 10 11:48:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 19 Oct 2011 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 13 21:09:39 2013 Received: (at control) by debbugs.gnu.org; 14 Jan 2013 02:09:39 +0000 Received: from localhost ([127.0.0.1]:58925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuZUY-0004cQ-9f for submit@debbugs.gnu.org; Sun, 13 Jan 2013 21:09:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23714) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuZUV-0004cB-27; Sun, 13 Jan 2013 21:09:36 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0E29CqL010440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 13 Jan 2013 21:09:12 -0500 Received: from [10.36.116.27] (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0E298NZ026283 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 13 Jan 2013 21:09:10 -0500 Message-ID: <50F368C4.2090906@draigBrady.com> Date: Mon, 14 Jan 2013 02:09:08 +0000 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Brad Cater Subject: Re: bug#13301: patch to preserve field order in cut References: <20121229000648.GB4838@dismay.proulx.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r0E29CqL010440 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: control Cc: 13301@debbugs.gnu.org, Bob Proulx X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) unarchive 6394 forcemerge 6394 13301 stop Note I documented how to achieve this with `awk` or `join` in the coreutils cut documentation at: http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3D38cdb0= 1 thanks, P=E1draig. From unknown Sun Aug 10 11:48:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 11 Feb 2013 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator