Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!cca!ima!johnl From: johnl@ima.UUCP Newsgroups: net.unix-wizards Subject: Re: /bin/sort bug - (nf) Message-ID: <387@ima.UUCP> Date: Wed, 31-Aug-83 18:40:37 EDT Article-I.D.: ima.387 Posted: Wed Aug 31 18:40:37 1983 Date-Received: Thu, 1-Sep-83 10:27:59 EDT Lines: 23 #R:ccieng5:-13300:ima:35700002:000:815 ima!johnl Aug 31 18:02:00 1983 I don't think that /bin/sort works right. ... The bottom line is that sort continues to look at the remaining fields in the line even though the "-pos" argument tells him not to. The sort page in my Unix manual says: When there are multiple sort keys, later keys are compared only after all earlier keys compare equal. Lines that otherwise compare equal are ordered with all bytes significant. so sort behaves exactly the way the documentation says it does. I think this language in the manual page dates back at least to V7. If you want a stable sort, you can number the lines, sort, and un-number them. On S/3, you could say: pr -t -n file | sort +1 -2 +0n | sed "s/^.....//" to do that. A "stable" option to sort would have to do the same internally. John Levine, ima!johnl