Skip to content

Instantly share code, notes, and snippets.

@gpr
Last active December 27, 2015 15:59
Show Gist options
  • Save gpr/7352071 to your computer and use it in GitHub Desktop.
Save gpr/7352071 to your computer and use it in GitHub Desktop.
How to get a specific field value with csvkit
#!/bin/bash
#
# csvget -- use csvkit too get a specific field value
#
# Usage: csvget <field_name> <line_number>
# get the field <field_name> value at the <line_number>th line
FieldName=${1:?}
N=${2:?}
csvcut -c "$FieldName" | sed -n ${N}p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment