strange 'sort' action

Tim Northrup tim at brspyr1.BRS.Com
Fri Dec 1 01:32:42 AEST 1989


linda at cc.brunel.ac.uk (Linda Birmingham) writes:
>When we restrict sorting to a particular field it still insists on sorting
>on the first field afterwards.
>Try    sort +1 -1.4 try
>where try is:
>wwww 0020 ctre ge
>tttt 0020 atre ge
>and notice that the tttt line is placed before the wwww line.
>Linda.

This action seems correct to me, at least on my interpretation of the
man page for sort(1).  From the System V User's Manual:

	"Lines that otherwise compare equal are ordered with
	 all bytes significant."

This is after the section discussing sort keys.

In my own opinion, since you only requested a sort on the 2nd word of
each line, you should consider the order of the remainder of the
fields as undefined!  I would expect the sort algorithm to only sort
on the fields I requested it to, and if 2 records are equal for those
tested fields then they would be placed on the output in whichever
order makes the sort program happy.  Just my 2 cents worth ...

						-- Tim
-- 
Tim Northrup      		  +------------------------------------------+
+---------------------------------+         GEnie:  T.Northrup               |
UUCP: uunet!crdgw1!brspyr1!tim    |   Air Warrior:  "Duke"                   |
ARPA: tim at brspyr1.BRS.Com	  +------------------------------------------+



More information about the Comp.sys.pyramid mailing list