I want to iterate in bash over this json string (generated with jq
) :
{
"hostname": "Arthhur",
"long": 10.234656,
"lat": 54.3454345
}
{
"hostname": "Zaphod",
"long": 10.12344324,
"lat": 54.35672134
}
...
to generate zipcodes from the location using:
plz=`wget -qO - "http://maps.googleapis.com/maps/api/geocode/json?latlng=$lat,$lng&sensor=true"|grep '"[0-9][0-9][0-9][0-9][0-9]"'|head -n1`
plz=${plz##*\ :\ \"}
plz=${plz%%\"*}
How can I pipe the string into a bash loop, so I can call that wget command for each hostname, having two variables inside the loop for long and lat ?