Subject: Re: bin/225: sort(1) ignores sorting keys
To: None <mhw@cs.brown.edu>
From: Wolfgang Solfrank <ws@tools.de>
List: netbsd-bugs
Date: 04/18/1994 11:55:31
I don't know how you get this idea.
> >How-To-Repeat:
> mhw ~ % cat > t
> a a a ab
> a a a aa
> mhw ~ % sort +0 -1 t
> a a a aa
> a a a ab
> mhw ~ % cat > t
> b a a ab
> a a a ab
> mhw ~ % sort +1 -2 t
> a a a ab
> b a a ab
That's exactly the documented behavior. This is the way any U*X sort command
has always behaved.
After all, the files ARE sorted on the fields you selected.
Records having the same value in the selected fields are sorted on the entire
line, as is documented in the man page:
Finally, as a last resort when all keys compare equal (or
if no ordering options were specified at all), sort com-
pares the lines byte by byte in machine collating
sequence. The -s option disables this last resort compar-
ison, producing a stable sort.
In fact, as you can see in the last sentence above, you can disable this
with the `-s' option (and this works as expected, too).
Hope this helps,
--
ws@TooLs.DE (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
------------------------------------------------------------------------------