You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've implemented an initial extension to csvgrep that allows specifying a search regex pattern and a replacement string (including references to groups via the regex pattern).
So as an example, given a CSV, this modifies column 1 by doing a
re.sub('-s flag', '-x flag', 'row[idx]') on each column specified via the -c flag.
I probably won't accept a pull request for this, because I don't believe it makes sense to bring data modification tools into csvkit. It opens up a Pandora's box of "I just want a tool that makes X change to a cell." At a certain point it's just more sensible to use existing tools (code, Excel, whatever). I've resisted this temptation until now and so far haven't regretted it.
Rereading, I hope that didn't sound too dismissive. I love that you're hacking on it and if you wanted to make your own repo I'd be happy to link to you from the docs. :)
lcorbasson
pushed a commit
to lcorbasson/csvkit
that referenced
this issue
Sep 7, 2020
I've implemented an initial extension to csvgrep that allows specifying a search regex pattern and a replacement string (including references to groups via the regex pattern).
So as an example, given a CSV, this modifies column 1 by doing a
re.sub('-s flag', '-x flag', 'row[idx]') on each column specified via the -c flag.
cat 2007.csv | csvgrep -s '(\s+|[a-zA-Z])' -x '\1' -r '.' -c 1 | head
The text was updated successfully, but these errors were encountered: