bug-coreutils
[Top][All Lists]
Advanced

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

Re: mistake in sort -k argument processing?


From: Andreas Schwab
Subject: Re: mistake in sort -k argument processing?
Date: Fri, 22 Dec 2006 15:19:22 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux)

Evan Hunt <address@hidden> writes:

> Observation:
>
>     $ sort -k1.0,2
>     sort: character offset is zero: invalid field specification `1.0,2'
>
> Now, this seems unnecessary to me; it *could* silently ignore the ".0" and
> treat it as if you hadn't specified a character offset.  (SCO does that.)
> But, regardless, if that *is* going to be an error, then shouldn't this:
>
>     $ sort -k1,2.0
>
> ...be an error as well?  It isn't.

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.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
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."




reply via email to

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