Sorry for cowering behind a pseudonymous email address,
but I have the same given names as certain famous people in
professions related to mine and wish to avoid confusion.  Moreover
such fame and identity as I have is tied to the delightful creature,
the woodchuck, after which I am pseudonamed.

Perhaps this is cowardly in certain nations more closely associated
with their former or present colonial Masters than my own; I should
concede that the genetic stock of such places might facilitate a deeper
understanding of criminality and cowardice than does that in a land
peopled through free will and whose folk's liberty was at one
point established by force of that will, instead of confounding one's
Masters with a dreary stew of sycophancy, beggary, stultification,
boredom, servile coarseness and expense.

That said,  consider the following:

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

Reply via email to