bug-coreutils
[Top][All Lists]
Advanced

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

Re: Feature request: counting fields/chars from the right.


From: Paul Eggert
Subject: Re: Feature request: counting fields/chars from the right.
Date: Wed, 13 Sep 2006 05:36:27 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

"Chris Dew" <address@hidden> writes:

> I was therefore thinking that cut could have a '-r, --count-from-right'
> switch, which would make all  field/column values 'right-relative'.

Thanks for the suggestion, but wouldn't it be better to allow people
to mix left-relative and right-relative fields in the same call to
'cut'?

How about preceding the Python/Ruby-like range with "@"?  Then we can
get everything Python/Ruby-like all at once, including zero origin
(which is clearer to me, at least).  We can also use : instead of - to
separate the values, to avoid ambiguity.  Thus,

cut -f @0 (instead of cut -f 1)
cut -f @1:3 (instead of cut -f 2-3)
cut -f @1:-1 (to get the sort of behavior you want)

Jim Meyering has the final say on this sort of thing of course, but I
think if we're going to do Python/Ruby-style ranges we should go all
the way.  (With "cut" and with other programs like "sort" too, but one
program at a time, I suppose.)




reply via email to

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