Re: wishlist: give cut(1) option to split fields on whitespace (original) (raw)

[Top][All Lists]


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


From: Mike Coleman
Subject: Re: wishlist: give cut(1) option to split fields on whitespace
Date: Wed, 9 Sep 2009 17:21:11 -0500

Pádraig,

I'm actually interested in whitespace blocks, rather than just runs of spaces, but I see that this was also discussed at the link. I suppose from a typability and readability standpoint I still prefer 'awk' to the alternative

$ tr '[:blank:]' ' ' | cut -d ' ' -f 3-5

although I'd still love to see the mooted

$ cut -w 3-5

since this seems like such a frequent CL use case.

More than that, I'm intrigued by the rationale for this decision. While I can appreciate conservatism on things like this, it's difficult to imagine any change other than i18n or bugfixes that would pass this criterion. And if changes are locked out, I wonder if coreutils/etc will ultimately ossify into one of those relics I remember wondering about when I got started in the 80s...

Thank you for the link and the insight! Mike

P.S. +1 for the domain name... :-)

2009/9/9 Pádraig Brady <address@hidden>:

Mike Coleman wrote: > It would be really nice if cut(1) could split fields using whitespace > as a separator (as many other text tools do).  Currently I use > >     $ awk '{ print 3,3, 3,4, $5 }' > > for this sort of thing, but it seems relatively klutzy, as opposed to (say) > >     $ cut -w -f 3-5

That was discussed a while ago: http://lists.gnu.org/archive/html/bug-coreutils/2009-05/msg00153.html

In summary the existing tr -s '[:blank:]' | cut -d ' ' was (marginally) deemed sufficient rather than supporting cut -d '[:blank:]'

cheers, Pádraig.