On Thu, Aug 20, 2009 at 04:10:35AM -0400, Woodchuck wrote:

> I have transposed the output to rows for ease of study.  For these
> examples, ascii collating order and numeric collating order are by
> coincidence the same.
> 
> cat testfile
> 16.88 16.54 15.12 15.00 14.57
> 
> sort testfile
> 14.57 15.00 15.12 16.54 16.88   ascii  CORRECT
> 
> sort -n testfile
> 14.57 15.00 15.12 16.54 16.88   numeric  CORRECT
> 
> sort -nr testfile
> 16.88 16.54 15.12 15.00 14.57   numeric reversed  CORRECT
> 
> sort -k1 testfile
> 14.57 15.00 15.12 16.54 16.88   ascii  CORRECT
> 
> sort -k1n testfile
> 14.57 15.00 15.12 16.54 16.88   numeric  CORRECT
> 
> sort -k1nr testfile
> 16.88 16.54 15.00 15.12 14.57   incorrect reversed numeric   FAILURE
> 
> In this example, f(i) >= f(i+1) (reverse numeric sort) is not true.
> 15.00 !>= 15.12   Note that the integer part is sorted correctly.
> Add some more 15.nm to the testfile to see more detail.
> 
> Do I misunderstand the man 1 sort entry concerning -k?  I suspect
> that attribute "n" is not working for -k.
> 
> Dave the Cowardly Marmot

You do not say which version of OpenBSD you are running. I tried your
example on current (amd64 and i386) and 4.5 (amd64) and did get the
proper results. 

        -Otto

Reply via email to