bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sort order bug in GNU sort


From: Eric Blake
Subject: Re: Sort order bug in GNU sort
Date: Thu, 29 Oct 2009 20:53:24 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Luke Hutchison on 10/29/2009 8:30 PM:
> given the inconvenience of changing
> locales in a script just so sort will work right, wouldn't it make
> sense to just add an optional switch that effectively sets LC_ALL=C
> for the sort?

It's already there, in the form of a per-command environment variable
change.  The FAQ mentions changing LC_ALL or LC_COLLATE up front, because
that is easiest, but you can fine-tune it down to the per-process level.
For example, this command runs two different sorts in two different
locales, in order to sort the first field by English dictionary order and
the second by byte order:

LC_ALL=en_US.UTF-8 sort -k1,1 | LC_ALL=C sort -k2,2

> Could the manpage please be extended to give a simple example
> comparing the sort order in the en_US locale with the C locale, to
> make this much clearer?

The man page comes from 'sort --help', and both try to be as concise as
possible.  But the info pages would be a reasonable place to add another
example, if it would help make it obvious what consequences are associated
with alternate locales.  Would you like to try your hand at writing the
patch, or at least propose the wording to use?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrqVSQACgkQ84KuGfSFAYAb+wCgv/uje2VKJs7BN3oltsmZxnfa
onMAnRqfxmNY/5VXeL/Bh6yVAYbL9m9/
=Bkoq
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]