 <blockquote> <p>How do I read json with bash?</p> </blockquote> <p>You can use <a href="http://stedolan.github.io/jq/" rel="nofollow"><code>jq</code></a> for that. First thing you have to do is extract the list of hostnames and save it to a bash array. Running a loop on that array you would then run again a query for each hostname to extract each element based on them and save the data through redirection with the filename based on them as well.</p>