coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] cut feature request


From: Eric Blake
Subject: Re: [coreutils] cut feature request
Date: Tue, 07 Sep 2010 11:52:01 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2

On 09/07/2010 10:29 AM, Laurent Lyaudet wrote:
Hi,
it would be useful that cut handles negative numbers parameters for
columns and fields as "from the end" parameters.
One could select the last field with -f -1 for example. (Currently, -f
-1 do the same that -f 1.)

Thanks for the report. I also wonder if allowing negative end fields for sort -k key specifiers also makes sense.

I didn't find a previous request that is similar in coreutils archive.
I think using awk or something similar is overkill for solving that
problem.

On the contrary, we tend to take the conservative position that if there is a POSIX-mandated tool that already does what you need, then adding an alternative shortcut to some other tool to do the same thing is very difficult to justify, on the grounds that you cannot rely on our extension, but can rely on awk's behavior, when porting to multiple systems. In other words, the bar for 'convenience' features is rather high before considering additions like this.

It may help us decide by showing a sample input file and a command line using your proposed extension, along with any awk alternative to do the same, to convince us that the verbosity required in awk is worth such a shortcut (or conversely, that the awk script is already so simple as to not be worth changing cut, as has already been our argument for the numerous times that people suggest teaching cut how to reorder fields).

Let me know what you think about it.

If we do it, I'd like to see it done uniformly across all the coreutils that take partial field specifications. And although I probably won't be the one writing such a patch, it does sound like it still might be justifiable.

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



reply via email to

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