On Mon, 20 Mar 2000, Raj Mathur wrote:

> One seems to be sorting in dictionary order (-d) while the other is
> doing it in ASCII, for whatever that's worth.

That was my first reaction. Did some hunting and ....

The problem seems to arise due to new POSIX standards that require that
"sort" respect the locale settings in particular LC_COLLATE which requires
that the locale describe the _order_ in which strings are to be compared.
With this requirement I find that several programs that use strcmp()
rather than the POSIXly correct strtoll() are broken. I now have two
choices: I either either sed through my old code that used the deprecated
strcmp() and replace with the correct function call, or change my locale
settings so that sort behaves in the older fashion (that '[' comes _after_
'[0-9]'')

Which brings me to my question: How do I change locale? I tried several
tracks like setting environment varibles etc, but nada. Would an
internationalizing guru come rescue me. This is much too hairy for me.

> BTW, read your interview in TOI yesterday.  Neat.  When can I have
> your autograph? :-)

You get me out of this mess and you can have my photograph too..;)

>     Guru>     The "sort" utility from the GNU textutils package
>     Guru> seems to be behaving differently between distributions. Here
>     Guru> is sample of the difference between SuSe 6.2 and RedHat 6.1:
> 
>     Guru> [RedHat 6.1]$ sort test ( (1) [1] 1 (2) [2] 2 (A) A [B] B
> 
>     Guru> [SuSE 6.2]$ sort test ( (1) (2) (A) 1 2 A B [1] [2] [B]
> 


-----------------------------------------------------------------------
The LIH mailing list archives are available at:
http://lists.linux-india.org/cgi-bin/wilma/linux-india-help

Reply via email to