bug-coreutils
[Top][All Lists]
Advanced

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

bug#7455: cut - lack of --merge-delimiters option


From: Leo Lopes
Subject: bug#7455: cut - lack of --merge-delimiters option
Date: Wed, 24 Nov 2010 12:15:56 +1100

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 <address@hidden>:
> 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}'
>
>





reply via email to

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