Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csvgrep: Add support for multiple files #1051

Closed
jamieburchell opened this issue Dec 19, 2019 · 3 comments
Closed

csvgrep: Add support for multiple files #1051

jamieburchell opened this issue Dec 19, 2019 · 3 comments
Labels

Comments

@jamieburchell
Copy link

Just like the regular grep command, it would be great if csvgrep supported multiple files. The implementation would need to take in to account the column headers present in each file.

Currently, I'm using cat to achieve what I need:

cat Files*.csv | csvgrep -c 4 -m "foo"

This could potentially match a column header in column 4 though, which wouldn't be the desired result.

@MrTrick
Copy link

MrTrick commented Mar 26, 2020

I'd find this very useful as well, for running csvcut to extract the same columns from multiple files and appending them together.

Currently I have to use xargs, eg:

ls files/*_[my glob pattern].csv | xargs -n 1 csvcut -d ';' -c mycolumn

And it's very slow, I think in part because it has to spawn csvcut over and over again.

@dannguyen
Copy link
Contributor

Is there any reason why you couldn't use csvstack for your situation? e.g.

csvstack *.csv | csvgrep -c 4 -m 'foo'

@jamieburchell
Copy link
Author

That works perfectly. I didn't realise it existed!

Closing this, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants