[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mistake in sort -k argument processing?
From: |
Evan Hunt |
Subject: |
Re: mistake in sort -k argument processing? |
Date: |
Fri, 22 Dec 2006 08:21:14 -0800 |
User-agent: |
Mutt/1.5.10i |
> 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.
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)... but POSIX here
seems to be using the first interpretation in one case and the second
one in the other. Odd. I kind of think they're wrong, and would
suggest silently ignoring the .0 in both the start and end spec
fields unless POSIXLY_CORRECT is set, but whatever. Thanks for
your reply.
Evan Hunt
- mistake in sort -k argument processing?, Evan Hunt, 2006/12/22
- Re: mistake in sort -k argument processing?, Andreas Schwab, 2006/12/22
- Re: mistake in sort -k argument processing?,
Evan Hunt <=
- Re: mistake in sort -k argument processing?, Andreas Schwab, 2006/12/22
- Re: mistake in sort -k argument processing?, Evan Hunt, 2006/12/22
- Re: mistake in sort -k argument processing?, Andreas Schwab, 2006/12/22
- Re: mistake in sort -k argument processing?, Evan Hunt, 2006/12/22
- Re: mistake in sort -k argument processing?, Jim Meyering, 2006/12/22
- Re: mistake in sort -k argument processing?, Evan Hunt, 2006/12/27