-
-
Save coderofsalvation/7692456 to your computer and use it in GitHub Desktop.
csv bashsnippet which allows outputting only nth column of a csv (Usage: cat my.csv | ./csv column 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# quickndirty csv column grep function (for easily selecting columns from csv e.g.) | |
# | |
# Usage: cat my.csv | csv column 2 | |
# | |
# csv is a handy database-format, its editable with an texteditor, importable/exportable by | |
# tech and end-users (mysql/excel/php etc) | |
# | |
column(){ | |
cat - | sed 's/,,,/###/g' | sed 's/,,/##/g' | sed 's/,/#/g' | cut -f$1 -d"#" | sed 's/"//g' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this function should be removed and is superseeded by supercut