Last active
December 5, 2016 08:29
-
-
Save ryo0301/893f5aff59984bf1e124 to your computer and use it in GitHub Desktop.
bashでjqを使ってJSONの配列をループさせる ref: http://qiita.com/ryo0301/items/2ac9d11f355f1cf52ea5
This file contains 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
#!/bin/bash | |
json=$(cat list.json) | |
len=$(echo $json | jq length) | |
for i in $( seq 0 $(($len - 1)) ); do | |
row=$(echo $json | jq .[$i]) | |
done |
This file contains 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
[ | |
{ | |
"key": "k1", | |
"val": "v1" | |
}, | |
{ | |
"key": "k2", | |
"val": "v2" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment