GNU bug report logs -
#7455
cut: support whitespace delimiters (like sort,join)
Previous Next
To reply to this bug, email your comments to 7455 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Sun, 21 Nov 2010 01:27:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Leo Lopes <lleeoo <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Sun, 21 Nov 2010 01:27:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi Folks,
Sorry to revive a 2-year old thread, but the rest of the thread is easy to find.
Exec summary: a user wanted a merge delimiters options, and the
discussion kind of digressed to "there is a more clever way to do it",
and "why should this be in cut"?
The responses in the thread as to why this feature isn't yet in cut
are reasonable for the issues raised there. However, the most
important (IMHO) use case wasn't considered:
The --merge-delimiters (or -m) feature should be part of cut because
people have come to expect that behavior from a column selector. Every
major application has this option. The fact that cut doesn't have the
feature is not a sign of good design, but rather historical accident.
When people don't find the feature, search for it, then find the
response "how come you don't know how to use awk and don't know this
special feature of ls?" it violates the principle of least surprise
among other things.
Cheers,
Leo.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Mon, 22 Nov 2010 01:35:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 7455 <at> debbugs.gnu.org (full text, mbox):
On 21/11/10 01:06, Leo Lopes wrote:
> Hi Folks,
>
> Sorry to revive a 2-year old thread, but the rest of the thread is easy to find.
>
> Exec summary: a user wanted a merge delimiters options, and the
> discussion kind of digressed to "there is a more clever way to do it",
> and "why should this be in cut"?
>
> The responses in the thread as to why this feature isn't yet in cut
> are reasonable for the issues raised there. However, the most
> important (IMHO) use case wasn't considered:
>
> The --merge-delimiters (or -m) feature should be part of cut because
> people have come to expect that behavior from a column selector. Every
> major application has this option. The fact that cut doesn't have the
> feature is not a sign of good design, but rather historical accident.
> When people don't find the feature, search for it, then find the
> response "how come you don't know how to use awk and don't know this
> special feature of ls?" it violates the principle of least surprise
> among other things.
This pops up every so often:
http://lists.gnu.org/archive/html/bug-coreutils/2009-09/msg00165.html
That thread, considered using: cut -d '[:blank:]'
but this was deemed sufficient: tr -s '[:blank:]' ' ' | cut -d ' '
I.E. it's marginal. However considering also that it's
awkward currently to parse /proc/partitions for e.g.
because it has leading blanks.
So perhaps if we did support the above, it could
have the extra functionality of ignoring leading blanks?
cheers,
Pádraig.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Mon, 22 Nov 2010 06:24:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 7455 <at> debbugs.gnu.org (full text, mbox):
Pádraig Brady wrote:
> On 21/11/10 01:06, Leo Lopes wrote:
>> Hi Folks,
>>
>> Sorry to revive a 2-year old thread, but the rest of the thread is easy to find.
>>
>> Exec summary: a user wanted a merge delimiters options, and the
>> discussion kind of digressed to "there is a more clever way to do it",
>> and "why should this be in cut"?
>>
>> The responses in the thread as to why this feature isn't yet in cut
>> are reasonable for the issues raised there. However, the most
>> important (IMHO) use case wasn't considered:
>>
>> The --merge-delimiters (or -m) feature should be part of cut because
>> people have come to expect that behavior from a column selector. Every
>> major application has this option. The fact that cut doesn't have the
>> feature is not a sign of good design, but rather historical accident.
>> When people don't find the feature, search for it, then find the
>> response "how come you don't know how to use awk and don't know this
>> special feature of ls?" it violates the principle of least surprise
>> among other things.
>
> This pops up every so often:
> http://lists.gnu.org/archive/html/bug-coreutils/2009-09/msg00165.html
>
> That thread, considered using: cut -d '[:blank:]'
> but this was deemed sufficient: tr -s '[:blank:]' ' ' | cut -d ' '
>
> I.E. it's marginal. However considering also that it's
> awkward currently to parse /proc/partitions for e.g.
> because it has leading blanks.
> So perhaps if we did support the above, it could
> have the extra functionality of ignoring leading blanks?
I agree that this is marginal.
However, seeing one example of how easy it is with awk
awk '{print $3,$4}' /proc/partitions
makes me wonder if it's just a question of documentation
and/or general education. cut is a very specialized tool.
If it doesn't do the job, using a more general-purpose one
is easy, once you see how. Do you think that adding a few
examples in "info cut" (including uses of awk) would suffice?
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Tue, 23 Nov 2010 12:53:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 7455 <at> debbugs.gnu.org (full text, mbox):
Thanks for replying.
>
> makes me wonder if it's just a question of documentation
> and/or general education. cut is a very specialized tool.
> If it doesn't do the job, using a more general-purpose one
> is easy, once you see how. Do you think that adding a few
> examples in "info cut" (including uses of awk) would suffice?
>
I think adding the awk or tr examples in the manpage/info page would
be helpful. However, I personally don't think it would suffice. I
think it would still violate the principle of least surprise.
Cheers,
Leo.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Tue, 23 Nov 2010 14:34:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 7455 <at> debbugs.gnu.org (full text, mbox):
On 23/11/10 12:57, Leo Lopes wrote:
> Thanks for replying.
>
>>
>> makes me wonder if it's just a question of documentation
>> and/or general education. cut is a very specialized tool.
>> If it doesn't do the job, using a more general-purpose one
>> is easy, once you see how. Do you think that adding a few
>> examples in "info cut" (including uses of awk) would suffice?
>>
>
> I think adding the awk or tr examples in the manpage/info page would
> be helpful. However, I personally don't think it would suffice. I
> think it would still violate the principle of least surprise.
Well it's still marginal in my mind.
The argument for supporting `cut -d '[:blank:]'` is that
`sort` and `join` for e.g. support this notion of a field by default,
so it's a very common requirement which we might want to
support directly, rather than relying on `awk`.
We should at least document something like this in: info cut invocation
Also consider using `awk` which supports more sophisticated field
processing. `awk` by default will use (and discard) blank characters
to separate fields. Leading and trailing blanks on a line are ignored.
Examples:
print the 2nd field: awk '{print $2}'
print the 2nd to last field: awk '{print $NF-1}'
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Tue, 23 Nov 2010 15:01:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 7455 <at> debbugs.gnu.org (full text, mbox):
On 23/11/10 14:37, Pádraig Brady wrote:
> On 23/11/10 12:57, Leo Lopes wrote:
>> Thanks for replying.
>>
>>>
>>> makes me wonder if it's just a question of documentation
>>> and/or general education. cut is a very specialized tool.
>>> If it doesn't do the job, using a more general-purpose one
>>> is easy, once you see how. Do you think that adding a few
>>> examples in "info cut" (including uses of awk) would suffice?
>>>
>>
>> I think adding the awk or tr examples in the manpage/info page would
>> be helpful. However, I personally don't think it would suffice. I
>> think it would still violate the principle of least surprise.
>
> Well it's still marginal in my mind.
>
> The argument for supporting `cut -d '[:blank:]'` is that
> `sort` and `join` for e.g. support this notion of a field by default,
> so it's a very common requirement which we might want to
> support directly, rather than relying on `awk`.
>
> We should at least document something like this in: info cut invocation
>
> Also consider using `awk` which supports more sophisticated field
> processing. `awk` by default will use (and discard) blank characters
> to separate fields. Leading and trailing blanks on a line are ignored.
>
> Examples:
>
> print the 2nd field: awk '{print $2}'
> print the 2nd to last field: awk '{print $NF-1}'
And another common question is about reordering fields
reorder the 1st two fields: awk '{print $2,$1}'
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Wed, 24 Nov 2010 01:11:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 7455 <at> debbugs.gnu.org (full text, mbox):
I think we are coming back to the same issue, and it is one of culture
and design choice, not of requirements and design needs. So it is
definitely marginal.
In essence, the argument is this: we don't need cut at all. Everything
cut can do, awk can do and other tools can also do. However, if we
will have a tool called cut that cuts columns, it should do at least
the basics that users expect. Among those expectations is merging
delimiters. When those expectations are not met customers are
dissatisfied.
Of course, you guys write and manage the tools, and this is a
management issue if there ever was one. So whatever decision you make
is the one people should be happy to live with. I am just putting my
2c in to the record.
Cheers,
Leo.
2010/11/24 Pádraig Brady <P <at> draigbrady.com>:
> On 23/11/10 14:37, Pádraig Brady wrote:
>> On 23/11/10 12:57, Leo Lopes wrote:
>>> Thanks for replying.
>>>
>>>>
>>>> makes me wonder if it's just a question of documentation
>>>> and/or general education. cut is a very specialized tool.
>>>> If it doesn't do the job, using a more general-purpose one
>>>> is easy, once you see how. Do you think that adding a few
>>>> examples in "info cut" (including uses of awk) would suffice?
>>>>
>>>
>>> I think adding the awk or tr examples in the manpage/info page would
>>> be helpful. However, I personally don't think it would suffice. I
>>> think it would still violate the principle of least surprise.
>>
>> Well it's still marginal in my mind.
>>
>> The argument for supporting `cut -d '[:blank:]'` is that
>> `sort` and `join` for e.g. support this notion of a field by default,
>> so it's a very common requirement which we might want to
>> support directly, rather than relying on `awk`.
>>
>> We should at least document something like this in: info cut invocation
>>
>> Also consider using `awk` which supports more sophisticated field
>> processing. `awk` by default will use (and discard) blank characters
>> to separate fields. Leading and trailing blanks on a line are ignored.
>>
>> Examples:
>>
>> print the 2nd field: awk '{print $2}'
>> print the 2nd to last field: awk '{print $NF-1}'
>
> And another common question is about reordering fields
>
> reorder the 1st two fields: awk '{print $2,$1}'
>
>
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#7455
; Package
coreutils
.
(Wed, 24 Nov 2010 07:12:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 7455 <at> debbugs.gnu.org (full text, mbox):
Pádraig Brady wrote:
> On 23/11/10 12:57, Leo Lopes wrote:
>> Thanks for replying.
>>>
>>> makes me wonder if it's just a question of documentation
>>> and/or general education. cut is a very specialized tool.
>>> If it doesn't do the job, using a more general-purpose one
>>> is easy, once you see how. Do you think that adding a few
>>> examples in "info cut" (including uses of awk) would suffice?
>>>
>>
>> I think adding the awk or tr examples in the manpage/info page would
>> be helpful. However, I personally don't think it would suffice. I
>> think it would still violate the principle of least surprise.
>
> Well it's still marginal in my mind.
>
> The argument for supporting `cut -d '[:blank:]'` is that
> `sort` and `join` for e.g. support this notion of a field by default,
> so it's a very common requirement which we might want to
> support directly, rather than relying on `awk`.
That is a compelling argument. For me, it has tipped the balance,
so now I'm slightly in favor of some sort of functional change.
> We should at least document something like this in: info cut invocation
>
> Also consider using `awk` which supports more sophisticated field
> processing. `awk` by default will use (and discard) blank characters
> to separate fields. Leading and trailing blanks on a line are ignored.
>
> Examples:
>
> print the 2nd field: awk '{print $2}'
> print the 2nd to last field: awk '{print $NF-1}'
Severity set to 'wishlist' from 'normal'
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 19 Oct 2018 01:56:01 GMT)
Full text and
rfc822 format available.
Changed bug title to 'cut: support whitespace delimiters (like sort,join)' from 'cut - lack of --merge-delimiters option'
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 19 Oct 2018 01:56:01 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 307 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.