coreutils
[Top][All Lists]
Advanced

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

Re: cut -DF


From: Rob Landley
Subject: Re: cut -DF
Date: Tue, 25 Jan 2022 16:50:38 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 1/25/22 3:39 PM, Pádraig Brady wrote:
> On 25/01/2022 07:55, Assaf Gordon wrote:
>> Hello,
>> 
>> Here's an updated patch for "cut -DF".
>> Since it's a new code path, it opens the possibility of finally
>> supporting multibyte characters with "cut -c".
>> 
>> 
>> comments very welcomed,
>>    - assaf
>> 
>>    [PATCH 01/18] cut: set-fields: add no-sort options
>>    [PATCH 02/18] cut: iniitial -D implmentation, currently only with
>>    [PATCH 03/18] tests: add 'cut -D' tests
>>    [PATCH 04/18] cut: extract 'cut -D -f' to a separate function
>>    [PATCH 05/18] cut: implement -D with -b
>>    [PATCH 06/18] tests: add 'cut -D -b' tests
>>    [PATCH 07/18] cut: add -O short-option for --output-delimiter
>>    [PATCH 08/18] cut: implement -F
>>    [PATCH 09/18] tests: add 'cut -F' tests
>>    [PATCH 10/18] cut: extract cut-fields into separate functions
>>    [PATCH 11/18] cut: implement multibyte -c/--characters
>>    [PATCH 12/18] cut: change -F regex syntax to BRE
>>    [PATCH 13/18] cut: change -D long-option equivalent
>>    [PATCH 14/18] doc: mention 'cut -D' in NEWS
>>    [PATCH 15/18] doc: mention 'cut -F' in NEWS
>>    [PATCH 16/18] doc: mention 'cut -O' in NEWS
>>    [PATCH 17/18] doc: mention multibyte 'cut -c' in NEWS
>>    [PATCH 18/18] doc: expand 'cut' section
> 
> Looking great!
> Some initial notes...
> 
> 0008
>    I was surprised that -D implies -s
>    (as there is no way to undo that without another option).

I was ready to make -s be a toggle (so you can switch it back on after -D) but
nobody ever asked for it. "I asked for the third and fifth words of each line
but a line with only one word will always pass it through" turns out not to be a
behavior in high demand.

Let me know if you decide to make -s toggle so I can propagate that to the
existing two implementations for consistency.

>    I'm even more surprised that -F implies -s
>    Fair enough for compat with existing implementations,
>    but please double check the -F behavior on existing implementations.

Neither toybox nor busybox have -F imply -s. The behavior of -F matches -f, and
you can use -D with -b or -f:

  $ echo -e 'one two three\nand' | cut -d' ' -f3,2
  two three
  and
  $ echo -e 'one two three\nand' | toybox cut -d' ' -Df3,2
  three two


Rob



reply via email to

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