Hi,
I am having a text file with the following contents
###########
File1
###########
some
page1.txt
text
page.txt
When I sort this file on Red Hat 5, then I get the following output
###########
File1
###########
page1.txt
page.txt
some
text
When I sort this file on Red Hat 4, then I get the following output
###########
File1
###########
page.txt
page1.txt
some
text
Can someone explain the reason for this behavior
-Sarbjit
Are you using the same locale on both systems when running sort?
If you run the command:
locale|grep LC_COLLATE
what is the output on both systems?
On Linux 4, the output of the Locale is :
LC_COLLATE="C"
On Linux5, the output is :
LC_COLLATE="en_US.UTF-8"
So is this behavior due to change in Locale value between Linux 4 and 5. Can I change the Locale for the system?
If you use:
LC_ALL=C sort File1
on both systems, you should get the same results on both systems. If the command:
locale -a|grep 'en_US.UTF[-]8'
prints en_US.UTF-8
on both systems, then if you use:
LC_ALL="en_US.UTF-8" sort File1
on both systems, you might also get the same results on both systems (although it seems strange to me that Red Hat 5's en_US.UTF-8 LC_COLLATE category chooses to sort ASCII characters into a different order than that specified by the C locale).
1 Like