[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request: handling space-delimited data with cut
From: |
Jim Meyering |
Subject: |
Re: Feature request: handling space-delimited data with cut |
Date: |
Sat, 16 May 2009 10:29:18 +0200 |
Pádraig Brady wrote:
> Eric Blake wrote:
>> According to Andrew McGill on 5/15/2009 4:10 AM:
>>> * There is no SIMPLE tool for handling space delimited data ({'$awk'} is
>>> not
>>> simple, IMHO)
>>
>> awk may not be as simple as some other tools, but it is standardized by
>> POSIX and is the application of choice for portable scripts when dealing
>> with space-delimited data. That's just a fact of life that you will have
>> to learn to live with.
>>
>>> 1. Adding an option (-w) similar to -f to cut words separated by whitespace
>>> (same rules as sort, unless the whitespace is changed to something else
>>> with -d)
>>
>> The bar for adding new options is very high. Supposing we added it, you
>> have to remember that it still cannot be used by portable scripts, but
>> only on installations where you know for sure that new enough coreutils is
>> installed. We tend to not want to bloat tool A if tool B can already do
>> the job in a standardized manner.
>
> I agree of course. It's hard to decide.
>
>>> I'm in favour of cut -w ... can I send a patch?
>>
>> Yes, anyone can send a patch. But be prepared to provide a VERY strong
>> case for its inclusion, or to get back the reply that we don't want to
>> risk incorporating it in the official upstream repository (but of course
>> you can continue using your patch on your personal installation).
Hi Pádraig,
> 90% of the time I use cut, I want it to split on whitespace.
Same here (though usually SP+TAB are all I care about).
That's why when I insist on using cut, I'd first filter the input
through e.g., tr -s '[[:blank:]]' ' '
Other times I might use awk, perl, or even ruby.
> How about supporting: cut -d '[:space:]'
Why? ;-)