I am using curl
`curl "https://maps.googleapis.com/maps/api/geocode/json?address=$WHERE&key=$API_KEY"`
and the result is
`
{
"results" : [
{
"address_components" : [
{
"long_name" : "Saket",
"short_name" : "Saket",
"types" : [ "political", "sublocality", "sublocality_level_1" ]
},
{
"long_name" : "New Delhi",
"short_name" : "New Delhi",
"types" : [ "locality", "political" ]
},
{
"long_name" : "South Delhi",
"short_name" : "South Delhi",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Delhi",
"short_name" : "DL",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
},
{
"long_name" : "110017",
"short_name" : "110017",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Saket, New Delhi, Delhi 110017, India",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 28.529262,
"lng" : 77.2166529
},
"southwest" : {
"lat" : 28.517834,
"lng" : 77.20113789999999
}
},
"location" : {
"lat" : 28.5245787,
"lng" : 77.206615
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 28.529262,
"lng" : 77.2166529
},
"southwest" : {
"lat" : 28.517834,
"lng" : 77.20113789999999
}
}
},
"place_id" : "ChIJ3T8F3fDhDDkRnxNgWBpc2Zc",
"types" : [ "political", "sublocality", "sublocality_level_1" ]
}
],
"status" : "OK"
}`
How can I just get the north-east latitudes and longitudes using bash ? Could you please tell me how I should parse it through jq, or another alternative. I need the values to be either saved in different text files. i.e lat.txt and long.txt. I'm planning to pass the latitude and longitude as variables and the use them in another api to get the air quality using the latitude and longitude. Even an alternative would work from which I can scrape the lat and long.