> I'm trying to sort a space deliminated file with six columns. I'd
> like to sort columns 2 and 4 in ascending order then sort column 5
> where columns 2and4 are uniq in decending numeric order.
> Following command seems to work on solaris 2.6 but not on 2.8.
> cat file|sort -k 2,4 -k 5nr
> any ideas?
It is not clear what you want, in particular what do
"sort columns 2 and 4 " and
"where columns 2and4 are uniq" mean?
Some examples would be good.
But, from what you say, you do not mean "-k 2,4" as
this takes in column 3 which you do not want.
Try: sort -k2,2 -k4,4 -k5,5nr file (you do not need cat).
Now, why should it change from Solaris 2.6 to 8?
A couple of possibilities spring to mind.
1. different locales (LC_COLLATE).
2. sort is not stable -- there are no guarantees about
what happens to items that compare equal.
3. you are being misled because your arguments to
sort do not mean what you think they do.