GNU bug report logs -
#6700
Sort question
Previous Next
Reported by: shtegtari <shtegtari <at> gmail.com>
Date: Thu, 22 Jul 2010 06:57:02 UTC
Severity: normal
Tags: moreinfo, notabug
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6700 in the body.
You can then email your comments to 6700 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#6700
; Package
coreutils
.
(Thu, 22 Jul 2010 06:57:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
shtegtari <shtegtari <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 22 Jul 2010 06:57: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)]
I have a text file that I can not sort correctly with the sort command, no
matter what switch I use. I would send it but wanted to see first whether
anyone reads this email.
Please respond and I will send the file.
Florent
[Message part 2 (text/html, inline)]
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#6700
; Package
coreutils
.
(Thu, 22 Jul 2010 12:06:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 6700 <at> debbugs.gnu.org (full text, mbox):
----- Original Message -----
From: "shtegtari" <shtegtari <at> gmail.com>
To: <6700 <at> debbugs.gnu.org>
Sent: Thursday, July 22, 2010 6:46 AM
Subject: bug#6700: Sort question
> I have a text file that I can not sort correctly with the sort command, no
> matter what switch I use. I would send it but wanted to see first whether
> anyone reads this email.
>
> Please respond and I will send the file.
>
> Florent
Wich locale or LANG did you use?
Did it work better with
LC_ALL=C sort
Gilles (not an answering machine)
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#6700
; Package
coreutils
.
(Thu, 22 Jul 2010 12:11:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 6700 <at> debbugs.gnu.org (full text, mbox):
tags 6700 +moreinfo
thanks
shtegtari wrote:
> I have a text file that I can not sort correctly with the sort command,
> no matter what switch I use. I would send it but wanted to see first
> whether anyone reads this email.
>
> Please respond and I will send the file.
Yes, people do read this mailing list. You might get ten replies to
your posting. But before sending a file the usual cause of confusion
is locales. There is an FAQ entry for it.
http://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021
This is documented in the info page.
info coreutils 'sort invocation'
(1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to
`en_US'), then `sort' may produce output that is sorted differently
than you're accustomed to. In that case, set the `LC_ALL' environment
variable to `C'. Note that setting only `LC_COLLATE' has two
problems. First, it is ineffective if `LC_ALL' is also set. Second,
it has undefined behavior if `LC_CTYPE' (or `LANG', if `LC_CTYPE' is
unset) is set to an incompatible value. For example, you get
undefined behavior if `LC_CTYPE' is `ja_JP.PCK' but `LC_COLLATE' is
`en_US.UTF-8'.
And the man page.
*** WARNING *** The locale specified by the environment affects
sort order. Set LC_ALL=C to get the traditional sort order
that uses native byte values.
What is your locale setting?
$ locale
Does setting LC_ALL=C resolve your problem?
Personally I have the following set in my ~/.bashrc file.
export LANG=en_US.UTF-8
export LC_COLLATE=C
If that does not resolve your problem please try to reduce the test
case to the smallest possible amount that illustrates the problem.
Frequently this can be done on the command line with printf.
$ printf "abc\nA B C\n" | sort
A B C
abc
Bob
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#6700
; Package
coreutils
.
(Thu, 22 Jul 2010 12:12:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 6700 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 07/21/2010 10:46 PM, shtegtari wrote:
> I have a text file that I can not sort correctly with the sort command,
> no matter what switch I use. I would send it but wanted to see first
> whether anyone reads this email.
It's hard to tell you what you are doing wrong if you don't provide the
command line you used, and at least two lines of the input file that
sorted differently than you expected given the command line you used.
Meanwhile, two common things to check:
Are you sure you are using the correct locale for your needs? Sorting
with LC_ALL=C is different than sorting with LC_ALL=en_US.UTF8, for example.
Are you sure you are specifying keys correctly? For example, -k1 is
much different than -k1,1.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Added tag(s) moreinfo.
Request was from
Bob Proulx <bob <at> proulx.com>
to
control <at> debbugs.gnu.org
.
(Thu, 22 Jul 2010 13:21:01 GMT)
Full text and
rfc822 format available.
Reply sent
to
Eric Blake <eblake <at> redhat.com>
:
You have taken responsibility.
(Thu, 22 Jul 2010 15:16:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
shtegtari <shtegtari <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 22 Jul 2010 15:16:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 6700-close <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 6700 +notabug
thanks
[re-adding the list]
On 07/22/2010 09:09 AM, shtegtari wrote:
> Thank you very much! Your response saved my hair from being pulled. It was
> the LC_ALL.
Closing this bug report, then.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Added tag(s) notabug.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Thu, 22 Jul 2010 17:14: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
.
(Fri, 20 Aug 2010 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 363 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.