[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: |
Pádraig Brady |
Subject: |
Re: Feature request: handling space-delimited data with cut |
Date: |
Sat, 16 May 2009 12:19:51 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Jim Meyering wrote:
> Pádraig Brady wrote:
>
> 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? ;-)
Sorry, I was playing devil's advocate but was too terse.
The advantage of cut -d '[:whatever:]' is that it would be trivial
to implement and would save a data copy between tr and cut.
Also if cutting a range of fields, one can maintain the original
separators which might be desired. Also since this is the common
case, it's slightly less syntax than tr .... | cut ....
The other side of the argument is that this is new functionality,
which is bad from a portability/documentation/learning standpoint.
I'm 55:45 against adding cut -d '[:blank:]'
cheers,
Pádraig.