[Top][All Lists]

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

Re: cut -DF

From: Assaf Gordon
Subject: Re: cut -DF
Date: Thu, 6 Jan 2022 16:02:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0


On 2022-01-06 7:35 a.m., Pádraig Brady wrote:
Thanks for taking the time to consolidate options/functionality
across different implementations.  This is important for users.
Some notes below...

On 05/01/2022 16:23, Rob Landley wrote:
Around 5 years ago toybox added the -D, -F, and -O options to cut:

     -D  Don't sort/collate selections or match -fF lines without delimiter
     -F  Select fields separated by DELIM regex
     -O  Output delimiter (default one space for -F, input delim for -f)

As I see it, the main functionalities added here:
   - reordering of selected fields
   - adjusted suppression of lines without matching fields
   - regex delimiter support

I see regex support as less important, but still useful.

Attached is a suggestion for initial implementation of "cut -FDO".
It's split into smaller steps to ease review.

The main issue is that the current "cut_fields" and "cut_bytes" are
highly optimized for speed, so I left them as-is and created a secondary
set of 'cut' functions - slower but with additional options.

If this is acceptable, I'll go on to clean up the patches, add more
tests and write documentation.

There are likely some edge-cases regarding regex matching that need to be decided upon (e.g. BRE or ERE, what about BOL/EOL anchors, groups, etc.).

Comments and feedback very welcomed,

 - assaf

Attachment: 0001-cut-set-fields-add-no-sort-options.patch
Description: Text Data

Attachment: 0002-cut-iniitial-D-implmentation-currently-only-with-f.patch
Description: Text Data

Attachment: 0003-tests-add-cut-D-tests.patch
Description: Text Data

Attachment: 0004-cut-extract-cut-D-f-to-a-separate-function.patch
Description: Text Data

Attachment: 0005-cut-implement-D-with-b.patch
Description: Text Data

Attachment: 0006-tests-add-cut-D-b-tests.patch
Description: Text Data

Attachment: 0007-cut-add-O-short-option-for-output-delimiter.patch
Description: Text Data

Attachment: 0008-cut-implement-F.patch
Description: Text Data

Attachment: 0009-tests-add-cut-F-tests.patch
Description: Text Data

reply via email to

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