From unknown Wed Jun 18 23:03:46 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#9808 <9808@debbugs.gnu.org> To: bug#9808 <9808@debbugs.gnu.org> Subject: Status: sort behavior Reply-To: bug#9808 <9808@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:03:46 +0000 retitle 9808 sort behavior reassign 9808 coreutils submitter 9808 mohamad hadi kianersi severity 9808 normal tag 9808 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 20 09:06:58 2011 Received: (at submit) by debbugs.gnu.org; 20 Oct 2011 13:06:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGsKo-0002Hm-2t for submit@debbugs.gnu.org; Thu, 20 Oct 2011 09:06:58 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGqPR-00077K-1U for submit@debbugs.gnu.org; Thu, 20 Oct 2011 07:03:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGqOE-00079e-8t for submit@debbugs.gnu.org; Thu, 20 Oct 2011 07:02:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_IMAGE_ONLY_04,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID, T_REMOTE_IMAGE, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:38694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGqOD-00079Q-RG for submit@debbugs.gnu.org; Thu, 20 Oct 2011 07:02:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]:35216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGqO7-0007fW-UU for bug-coreutils@gnu.org; Thu, 20 Oct 2011 07:02:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGqO6-00078d-2E for bug-coreutils@gnu.org; Thu, 20 Oct 2011 07:02:15 -0400 Received: from mail-vx0-f169.google.com ([209.85.220.169]:49075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGqO5-00078I-U0 for bug-coreutils@gnu.org; Thu, 20 Oct 2011 07:02:13 -0400 Received: by vcbfk1 with SMTP id fk1so3078332vcb.0 for ; Thu, 20 Oct 2011 04:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=cMks/ntfOM0Cq5Jde8dZbUnBxtbmu4E1YgyFg83nbxI=; b=fJ0nHDiwDUixMFISnESXIzOjT4fNVqYAa2GgcI6DTHgwoi+OLs5YoediU6ZtcnPRSa EMDpbbj0vRqIaYryq3+AdCQ8LOd+u+1hnnGfBmhU6ewl2sS9XCQzVFp9mQJtVRi2Tf95 /oxBiOUBHkwIBvJeh2Ll2kP9VevBBEYizyumc= MIME-Version: 1.0 Received: by 10.52.74.69 with SMTP id r5mr954759vdv.51.1319108532482; Thu, 20 Oct 2011 04:02:12 -0700 (PDT) Received: by 10.52.114.71 with HTTP; Thu, 20 Oct 2011 04:02:12 -0700 (PDT) Date: Thu, 20 Oct 2011 14:32:12 +0330 Message-ID: Subject: bug report From: mohamad hadi kianersi To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary=bcaec50162877fb2f704afb8e313 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -3.9 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 20 Oct 2011 09:06:56 -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: -3.9 (---) --bcaec50162877fb2f704afb8e313 Content-Type: text/plain; charset=ISO-8859-1 Hi when use sort with option k(key)r(revers) after these options when use n(numeric) dont sort with numeric option -- Mohamad Hadi Kianersi --bcaec50162877fb2f704afb8e313 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi
when use sort with option k(key)r(revers) after these options when us= e n(numeric)=A0 dont sort with numeric option


-- <= br>
Mohamad Hadi Kianersi

--bcaec50162877fb2f704afb8e313-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 20 09:31:52 2011 Received: (at 9808) by debbugs.gnu.org; 20 Oct 2011 13:31:52 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGsir-0002tf-PH for submit@debbugs.gnu.org; Thu, 20 Oct 2011 09:31:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGsik-0002tJ-LY; Thu, 20 Oct 2011 09:31:47 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9KDUScE009654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 20 Oct 2011 09:30:28 -0400 Received: from [10.3.113.158] (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9KDUR6V018461; Thu, 20 Oct 2011 09:30:28 -0400 Message-ID: <4EA02273.9030501@redhat.com> Date: Thu, 20 Oct 2011 07:30:27 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15 MIME-Version: 1.0 To: mohamad hadi kianersi Subject: sort behavior [was: bug#9808: bug report] References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.3 (----------) X-Debbugs-Envelope-To: 9808 Cc: 9808@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 (----------) retitle 9808 sort behavior tag 9808 moreinfo thanks On 10/20/2011 05:02 AM, mohamad hadi kianersi wrote: > Hi > when use sort with option k(key)r(revers) after these options when use > n(numeric) dont sort with numeric option Thanks for the report. However, you did not give us any details with which to reproduce your claim of the behavior you tried, the output you got, and the output you expected. Would you mind pasting an actual 3 or 4 line file, and the actual sort command line you used, to demonstrate the question you are asking? Most likely, it will turn out that the problem is not a bug in sort, but that you are using it incorrectly. For an example, here's something I tried based on your explanation, but I have no idea if I'm reproducing the behavior you are questioning: $ printf '10 a\n1 b\n2 c\n' | sort -n -r -k1,1 10 a 2 c 1 b Also, have you tried using 'sort --debug'? Newer coreutils provides this as a great way to understand a lot of situations why sort is behaving correctly, but differently than your expectations. Your bug report was low quality. I'd suggest reading this page, and take to heart the ideas such as a better subject line and doing more to help the developers reproduce your issue: http://www.catb.org/~esr/faqs/smart-questions.html -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 20 09:50:17 2011 Received: (at control) by debbugs.gnu.org; 20 Oct 2011 13:50:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGt0j-00042j-Dy for submit@debbugs.gnu.org; Thu, 20 Oct 2011 09:50:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGt0f-00042N-BE; Thu, 20 Oct 2011 09:50:15 -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 p9KDmxwR021856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 20 Oct 2011 09:48:59 -0400 Received: from [10.3.113.158] (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9KDmwAG024249; Thu, 20 Oct 2011 09:48:58 -0400 Message-ID: <4EA026CA.1020604@redhat.com> Date: Thu, 20 Oct 2011 07:48:58 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15 MIME-Version: 1.0 To: mohamad hadi kianersi , 9808-done@debbugs.gnu.org Subject: Re: sort behavior [was: bug#9808: bug report] References: <4EA02273.9030501@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; 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 (----------) tag 9808 = notabug thanks Re-adding the list, so that others may benefit from the solution or chime in with suggestions. On 10/20/2011 07:36 AM, mohamad hadi kianersi wrote: > yes,but view these > > 1. > [hadi@hadi ~]$ printf '10 a\n1 b\n2 c\n' | sort -k1,1 -r -n > 10 a > 2 c > 1 b > > but > [hadi@hadi ~]$ printf '10 a\n1 b\n2 c\n' | sort -k1,1r -n > 2 c > 10 a > 1 b > cant sorted with numeric Did you try 'sort --debug' like I suggested? $ printf '10 a\n1 b\n2 c\n' | LC_ALL=C sort -k1,1r -n --debug sort: using simple byte comparison sort: option `-n' is ignored 2 c _ ___ 10 a __ ____ 1 b _ ___ Notice - sort is _correctly_ ignoring -n, and --debug even tells you so, per the rules given by POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html "The following options shall override the default ordering rules. When ordering options appear independent of any key field specifications, the requested field ordering rules shall be applied globally to all sort keys. When attached to a specific key (see -k), the specified ordering options shall override all global ordering options for that key." [d, f, i, n, r] That is, the moment you use -k with r attached, then the global -n no longer applies to that -k; to get both r and n behavior on a single key, you have to attach both options to that -k: $ printf '10 a\n1 b\n2 c\n' | LC_ALL=C sort -k1,1rn --debug sort: using simple byte comparison 10 a __ ____ 2 c _ ___ 1 b _ ___ As such, I'm closing this bug report, now that we know the problem was a usage error and not a bug in sort. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From unknown Wed Jun 18 23:03:46 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 18 Nov 2011 12:24:02 +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