Skip to content

Instantly share code, notes, and snippets.

@vochicong
Created September 12, 2017 05:50
Show Gist options
  • Save vochicong/04e84e0c84fc8f972d1c7f3861f6998a to your computer and use it in GitHub Desktop.
Save vochicong/04e84e0c84fc8f972d1c7f3861f6998a to your computer and use it in GitHub Desktop.
jq to extract a json value from CSV
# Input: 901,1,187,7,1,example@gmail.com,"{""u"":""name"",""limit_date"":""2017/09/18 23:59"",""token"":""b0kasdfuadf3jdadfubd"",""language"":""ja""}",9/12/17 9:01,NULL,NULL,NULL,9/11/17 15:59,9/11/17 16:00,NULL
# Output: b0kasdfuadf3jdadfubd
cat token_lists.csv | jq -R 'split(",") | .[8] | split("\"") | .[6]' | sed 's/"//g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment