How to sort on exactly one field only

Doug Gwyn gwyn at smoke.brl.mil
Fri Oct 26 15:42:05 AEST 1990


In article <1757 at b15.INGR.COM> rob at b15.INGR.COM (Rob Lemley) writes:
>The man page clearly states that you cannot cause sort to ignore a field
>or preserve relative line ordering.

"sort" does ignore non-key fields except when keys compare equal.
To obtain a stable sort, add line numbers, sort on the keys you
wanted followed by the line numbers as an additional key, then
strip off the line numbers.



More information about the Comp.unix.questions mailing list