csvtools icon indicating copy to clipboard operation
csvtools copied to clipboard

cvsgrep : pattern based on column indexes

Open stf8 opened this issue 6 years ago • 1 comments

As of now csvgrep only supports column names as pattern key. This PR adds support for column indexes.

I did not went for a new option (aka -P) as it would have required to modify the existing structures and count mechanisms.

So everything works as before, except that if your column name is #<number> and there is no actual column named that way, then it's supposed to be a column index (starting from 0), e.g : -p '#1/^abc/' matches all lines with the 2nd column content starting with abc (excluding header).

I also added simple a test for that.

Things might not be fully compliant with the existing style, so feel free to ask for any refactoring

This PR also include a small fix for issue #15 (tested on Ubuntu 14, Centos 7)

stf8 avatar Jul 20 '19 13:07 stf8

(If you rebase/merge from master, I think I fixed the failing travis build for PRs.)

DavyLandman avatar Aug 03 '19 13:08 DavyLandman