Sort command results are different in Redhat 4 vs Redhat 5


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Sort command results are different in Redhat 4 vs Redhat 5
# 1  
Old 04-16-2013
Sort command results are different in Redhat 4 vs Redhat 5

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
# 2  
Old 04-16-2013
Are you using the same locale on both systems when running sort?
If you run the command:
Code:
locale|grep LC_COLLATE

what is the output on both systems?
# 3  
Old 04-17-2013
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?
# 4  
Old 04-17-2013
If you use:
Code:
LC_ALL=C sort File1

on both systems, you should get the same results on both systems. If the command:
Code:
locale -a|grep 'en_US.UTF[-]8'

prints en_US.UTF-8 on both systems, then if you use:
Code:
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).
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Increase command length for ksh shell on Redhat Linux

I have a ksh shell script and i need to pass arguments which are generated by data pulled from a database. When the argument to the shell script is too long (about 4000 charecters) the below is the issue observed. I copy the command which is 4000 charecters long from the logs and paste it... (7 Replies)
Discussion started by: mohtashims
7 Replies

2. Red Hat

What is command to setup sofware in redhat over internet

Hi all, I setup redhat in VMware and I connected to internet, so I want setup sofware for redhat over internet what is command I used ? Are you understand my question, my ability of english is not good, such as I want setup dhcp packet I must used a command ? (yum... or...apt-get...or rpm... ?... (4 Replies)
Discussion started by: ilinux9
4 Replies

3. UNIX for Dummies Questions & Answers

LINUX SORT command chops results

I am trying to sort a file . The file looks like this: DDFF 2 /ztpfrepos/pgr/load DDFQ 2 /ztpfrepos/pgr/load DDFX 2 /ztpfrepos/pgr/load DDUA 2 /ztpfrepos/pgr/load My command: sort -k1 /home/c153507/Bin/OPL1.txt -o /home/c153507/Bin/OPL1.txt The results are OK except for one line where... (4 Replies)
Discussion started by: Yahalom
4 Replies

4. Red Hat

lshal command is not working in RedHat

lshal command is not working in RadHat Linux 9. Whether it is not supported in RedHat or is any other equivalent command for lshal ? (7 Replies)
Discussion started by: forumguest
7 Replies

5. UNIX for Advanced & Expert Users

RedHat, Solaris - what is uname command ??

Hi ! All I'm big fan of Unix/Linux . I want understand the basics of linux/unix version and How they are related to Vendor ... releases. uname -a will give the OS details. But can somebody provide me a pointer , to understand the very BASICS of these terminology like Million Thanks.!!! (2 Replies)
Discussion started by: dashok.83
2 Replies

6. UNIX for Dummies Questions & Answers

Redhat linux command to check Version

Hi All, I need to know RedHat linux version installed on a different servers. I know uname -a or /proc/version Is any other command to know the Linux version???? When we telnet to any of the Linux server, the version shows very clearly like Red Hat Enterprise Linux ES release 3 (Taroon... (1 Reply)
Discussion started by: bache_gowda
1 Replies

7. Red Hat

redhat

if sombody can help it will be very good.I want to have some information concerning redhat 9.How to go in the internet with :confused: ,how to programmate in c or c++,and finally how i can use it esaly.Sorry for my english i'm a french speaker ;) (1 Reply)
Discussion started by: boyep
1 Replies

8. SuSE

redhat

i just bought a redhat 9.0 book which comes with the operating system and Ive install it as a server however Im having difficulties installing Swat and I just wonder if I have to spend buy an enterprise server or what ? (1 Reply)
Discussion started by: keliy1
1 Replies

9. UNIX for Advanced & Expert Users

MYSQL command to take a backup of the database in Redhat linux 7.2

I am new to mysql database , we have a mysql database running on linux , and we use mysql database for bugzilla, so we wanted to take a backup . what is the command for taking the entire database backup from the command prompt with all options. Thanks in advance Bache Gowda (4 Replies)
Discussion started by: bache_gowda
4 Replies

10. Linux

redhat

hello people i just installed redhat, everything seemes to be fine, but when i start it, it boots up normally and starts firstboot or whatever, then it opens something, i can move the mouse for a while(thats all i see.. first the X then an arrow..) but then the whole computer freezes.. i think the... (3 Replies)
Discussion started by: thenewestuser
3 Replies
Login or Register to Ask a Question