Evan Hunt <[EMAIL PROTECTED]> writes:

>> POSIX specifies that that character position (if present) shall be
>> positive for the field start spec and non-negative for the field end spec
>> (with zero denoting the last character of the field).  Thus GNU sort is
>> behaving correctly.
>
> Ah, okay, thanks.
>
> Bit of a doc problem in "info sort", then:
>
> `-k POS1[,POS2]'
> `--key=POS1[,POS2]'
>      Specify a sort field that consists of the part of the line between
>      POS1 and POS2 (or the end of the line, if POS2 is omitted),
>      _inclusive_.  Fields and character positions are numbered starting
>      with 1.       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      ^^^^^^
>
> ...so I figured the 0 wasn't supposed to be allowed.

That does not contradict the use of 0 to describe the special case of the
_last_ character (which has a varying, non-zero position in every field).

> It seems to me that the principle of least surprise would mandate
> that .0 in a position spec should either be the equivalent of not
> setting a character offset, *or* that it should mean the "zeroth"
> character of the field (which would be an error)...

There is no such thing as a "zeroth" character in the position counting.
For the start field you cannot denote the last character, so using 0 does
not make sense.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to