bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10019: sort options -Mn are incompatible


From: Eric Blake
Subject: bug#10019: sort options -Mn are incompatible
Date: Sat, 12 Nov 2011 06:54:04 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

On 11/12/2011 03:49 AM, Lars Noodén wrote:
> On 11/11/11 9:43 PM, Paul Eggert wrote:
>> On 11/11/2011 11:36 AM, Lars Noodén wrote:
>>> An additional line of clarification would go a long way in making
>>> this very useful capability more available.
>>
>> Hmm, what line would that be?  We do have a tradeoff among clarity,
>> completeness, and conciseness here.
> 
> Maybe something like this?
> 
>        -k, --key=POS1[,POS2][ORD]
>               start a key at POS1 (origin 1), end it at POS2 (default
>           end  of line) using ordering option(s) ORD (fghMnrR)

Except you missed out on at least b and V.  Also, the current wording:

  -k, --key=POS1[,POS2]     start a key at POS1 (origin 1), end it at POS2
                            (default end of line).  See POS syntax below

was nice in referring to the text at the bottom:

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.

In particular, -k1b,1 is different than -k1,1b, but most other OPTS can
occur in either position with no change in behavior.

I like [OPTS] slightly better than [ORD], given that you can have more
than one (as in -k1bn,1).  I do agree that on the -k line, the use of
"POSn" hides the [.C][OPTS] of the text below, and that it is too easy
to think that POSn is a synonym for just the F. POSIX calls the same
thing 'keydef', so maybe:

  -k --key=KEYDEF  control where a key starts and ends, and give
                   ordering specific to the key. See KEYDEF below.

KEYDEF is F[.C][OPTS][,F[.C][OPTS]], where F is a field number and C
a character position in the field; both are origin 1.  If the second
position is omitted, the key runs to the end of the line.  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 [bdfgiMhnRrV], which override global
ordering options for that key.  If no key is given, use the entire line
as the key.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]