Operating System - HP-UX
1752770 Members
4886 Online
108789 Solutions
New Discussion юеВ

Re: Sort command compatability issue

 
AnandPN
New Member

Sort command compatability issue

I have an Hp-UX box with Release 11.00.
We want to migrate shell scripts from HP-UX to Suse Linux box.
I am facing an issue with sort command.
When used sort with -u option in HP-UX, the command is deleting few records though they are unique. The number of records are getting reduced.

But the same command works fine in Linux.
Is there any compatibility issue with Sort command from HP-UX to Suse Linux. Please provide an alternate to get through this.

Thanks
Anand
3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: Sort command compatability issue

>When used sort with -u option in HP-UX, the command is deleting few records though they are unique.

What does you sort command look like?
What are the deleted records?

If you are going to Linux, why do you care what HP-UX sort did, that you didn't like?
AnandPN
New Member

Re: Sort command compatability issue

Hi,
Below is the few set of records I have in my file
STD054955140 1994-03-02-11.09.00.0000009999-12-31-11.09.00.000000NKKC8
STD054955220 1994-03-02-11.09.00.0000009999-12-31-11.09.00.000000NKKCB
STD054955280 1994-03-02-11.10.00.0000009999-12-31-11.10.00.000000NKKCC
STD054955330 1994-03-02-11.10.00.0000009999-12-31-11.10.00.000000NKKAF
STD054955350 1994-03-02-11.11.00.0000009999-12-31-11.11.00.000000NKKAI
STD054955370 1994-03-02-11.11.00.0000009999-12-31-11.11.00.000000NKKAC
STD054955390 1994-03-02-11.13.00.0000009999-12-31-11.13.00.000000NKKAJ
STD054955410
But after calling the below command, few lines are getting deleted in HP-UX.

sort -u -o STD054.new STD054.new
(STD054.new is the file contains the above data)

Why the sort command is deleting the lines even if they are unique?
After sorting the number of lines are reducing.
and all the locale env variables are same both in Linux and HP-UX
LC_CTYPE="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_MESSAGES="C"
LC_ALL=

Just want to check is there any other setting in UNIX which is impacting sort criteria?

Thanks
Anand

Dennis Handly
Acclaimed Contributor

Re: Sort command compatability issue

>But after calling the below command, few lines are getting deleted in HP-UX.

Which lines? Are they still missing if you remove -u?
I get all 8 lines on 11.23.

>Just want to check is there any other setting in UNIX which is impacting sort criteria?

sort(1) only lists the ones you have.