Re: sort

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

 



>I am not sure what is going on in your system byut both sort and sort
>-n on those three lines gives for me:
>12.37.89.3
>12.96.86.83
>128.52.23.9
>
>which looks ok to me. What did you want to see?

Sorry for the confusion - those 3 lines won't show the anomoly for the -n and -g cases.  I had to look through hundreds of IP addresses to see that sometimes the 3rd octet isn't sorted as expected. I never bothered to produce a minimal example as I wanted a pure ascii sort, not a numeric sort. I started playing with -n and -g just to get a feel for what might be happening with no options specified.

As for the plain no option sort, the output is identical to the input on my systems for rh7.2 and rh9. 

>You do in the C locale.  In any other locale, the locale's sorting
>rules apply.
>
>For pure ASCII sorting, you need to do: LC_COLLATE=C sort

Thanks Tim, that did the trick. I never realized that the collating sequence could be influenced by environment variable. Your hint led me to google for LC_COLLATE and that led to man bash for more info.

All my systems have is LANG=en_US and therefore that's what I get for LC_COLLATE. 
I haven't found what the actual collating sequence is for en_US yet, but I'll hunt it down to satisfy my curiosity.


Bill Gradwohl
(817) 224-9400 x211
www.ycc.com
SPAMstomper Protected Email




[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux