2009/1/8 Michael Stone <mst...@debian.org>:
> On Thu, Jan 08, 2009 at 11:04:21AM +0000, George B. wrote:
>>
>> Severity: important
>
> Please don't overinflate bug severities.

Sorry, that should have been "normal" at most.

> "disk" is not a number, and won't sort numerically. For your particular case
> you could use "sort -k 1.5n" to begin sorting after "disk".

Thanks for your help - that sorts correctly now.

That said this was not at all obvious from the man-page.
---
-n, --numeric-sort
              compare according to string numerical value
...
k, --key=POS1[,POS2]
              start a key at POS1, end it at POS2 (origin 1)
...
POS is F[.C][OPTS], where F is the field number  and  C  the  character
       position  in  the field; both are origin 1.  If neither -t nor -b is in
       effect, characters in a field are counted from  the  beginning  of  the
       preceding  whitespace.   OPTS  is  one  or  more single-letter ordering
       options, which override global ordering options for that  key.   If  no
       key is given, use the entire line as the key.
---

I have re-read all this several times having had the benefit of your
example but I still do not understand how I was supposed to have
figured it out from that.

The description of "-n" makes it sounds useful (implies to me that
numerical value of string compared and as first part is the same it
should have sorted correctly). Personally, I see no logical reason why
this doesn't work. If the first part is the same then you only look at
the part that is different. If there are blocks of numbers involved,
sort them numerically, without requiring leading zeros.

Additionally, the description for "-k" does not mention the OPTS at
all (description is embedded in notes about POS below). In my mind
description for "-k" should at least mention OPTS because POS
(combined with description for "-k") to me just implies "position" and
there is no note to read below for further explanation. Incidentally,
why not include the POS explanation as part of the "-k" description?

[rant]The last block about POS makes my head hurt. I love Linux, but
why does it have to be so difficult to do something as simple getting
a numerically sorted list of files?[/rant] :-(


Thanks for the helpful example,

George.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to