csvkit
csvkit copied to clipboard
csvclean: options for stdout and stderr
to output the fixed file on stdout and errors on stderr
This def makes sense as an option. Should be a quick fix for a future release.
This feature would be greatly appreciated. I like using csvclean piping in only some rows from sed. When you've got close to a million records passing it all through at once isn't all that helpful. I can't save the output since the file appears to be based on base, which is presumably the file name pass when calling csvclean (see line #37).
If you could send the output to stdout, data flowing from stdin can be more easily saved.
Another feature that may make sense while making this change is specifying the output file path. Looks like you'd have to modify from use base to an argument and using base + '_out' as a fallback.
I'd make the change myself, but I've only done light scripting in Python and am not great at following OO code.
Loving csvkit. Would be even better if csvclean could send to stdout so I could include as part of a longer pipe. Wonder if this feature is on the roadmap ?
What I think would be awesome is to have an option to make exit csvclean with a non 0 status code if errors are detected. That would make it easy to integrate it as a csv lint tool.
To do:
- STDOUT for output
- STDERR for errors
- non-0 exit status if errors
Any word on this?
There's a PR #781
For now you can use it with:
pip install --upgrade -e git+https://github.com/wireservice/csvkit.git@csvclean#egg=csvkit