On 02/26/2011 11:28 AM, Betty J Barr wrote:
> I have used the "unix" sort for years without trouble, but suddenly
> something weird is happening. I have a student whose last name is Khan,
> and a student whose last name is Khanal,. The comma immediately follows
> the last name. Obviously Khan should be sorted before Khanal, both from
> the English standpoint and based on the ASCI code for a comma. But it is
> not. Khanal comes first. Why?

Because you are using a locale that regards punctuation as insignificant
in collation sequences.

See this FAQ, then try 'LC_ALL=C sort ...' to see the difference.
 
http://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021

Also, newer coreutils (the latest is 8.10) includes 'sort --debug' to
help diagnose problems like this.

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to