Skip to content

Instantly share code, notes, and snippets.

@novemberkilo
Last active December 1, 2020 01:37
Show Gist options
  • Save novemberkilo/f58da37c276e023ef9c25feb601bbc64 to your computer and use it in GitHub Desktop.
Save novemberkilo/f58da37c276e023ef9c25feb601bbc64 to your computer and use it in GitHub Desktop.
cli hints and tricks
## Sum the numbers in a column with header 'value'
cat data.csv | xsv select value | tail -n+2 | awk '{ SUM += $1} END { print SUM }'
## xargs with multiple ops -- here drop a column from all csv in this dir and store results
## in another directory
ls | xargs -L 1 -I 'file' sh -c "xsv select '\!original_area_code' 'file' > no_original_area_code/'file'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment