Skip to content

Instantly share code, notes, and snippets.

@fabifrank
Created August 13, 2018 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabifrank/ca6269b4262022afd6df900af26f8801 to your computer and use it in GitHub Desktop.
Save fabifrank/ca6269b4262022afd6df900af26f8801 to your computer and use it in GitHub Desktop.
#!/bin/bash
# read json entries line by line in a file and extract property of it
# usage:
# ./extract-json-prop.sh <FILENAME> <QUERY>
# example
# ./extract-json-prop.sh test.json .query.test
while IFS='' read -r line || [[ -n "$line" ]]; do
echo $line | jq "$2"
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment