Operating System - HP-UX
1833850 Members
1854 Online
110063 Solutions
New Discussion

Re: How to suppress last resort comparison while sorting a key field

 
Sudeepta Ojha
New Member

How to suppress last resort comparison while sorting a key field

I need to perform a sort in the file with some key fields, in that i want to suppress last resort comparison. Since the sort on the key field in not giving stable sort.
Please help
1 REPLY 1
Hein van den Heuvel
Honored Contributor

Re: How to suppress last resort comparison while sorting a key field



I don't think you can stop hpux sort from 'helping' you.
If you have modest amounts of data to sort,then you may want to consider pre-pending a line-number, sort, and remove.
'modest' could still be 100 MB or so.

Sample 'one-liner':
awk '{printf ("%06d %s\n",NR,$0)}' x | sort -k 2,2 -k 3,3 | cut -b 7-

For a similar problem and prior discussion see:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=636317

hth,
Hein.