Subject: Re: bug#9281: Is this expected behavior?
From: Eric Blake <[email-masked]>
To: Ajesh Shaj <[email-masked]>
Cc: [email-masked]
Date: Thu, 11 Aug 2011 06:04:48 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

tag 9281 notabug
thanks

On 08/11/2011 12:31 AM, Ajesh Shaj wrote:
> Hi,
>
>      I got a strange ordering when I applied the linux sort command. Please see below for the details:
>
> [ajesh@gwta3004 tmp]$ sort a
> .a
> .b
> ba
> bb
> bc
> .c
>
>
> NOTE: .a and .b appears before ba and bb, where as .c appears after bc.

 > Is this expected behavior?

Yep.  And this is a FAQ, caused by you using a locale that ignores 
punctuation when determining sort order.

https://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021

If you are using new enough coreutils, try:

sort --debug a

for better understanding what is happening, then compare to:

LC_ALL=C sort --debug a

(if your sort doesn't understand --debug, then it is still useful to try 
LC_ALL=C sort a).

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