How can I extract the ip address and the country and put them individual in a string without any quotes or any other characters which are present in the text by using the next command:
info_ip=`wget --tries=1 --timeout=10 -qO- http://ipinfo.io/?callback=callback; echo`
Now I'm looking to filter the data for ip and country
$ip = ?
$country = ?
ipinfo.io
currently returns something like:
/**/ typeof callback === 'function' && callback({
"ip": "198.51.100.123",
"hostname": "host.example.com",
"city": "Example City",
"region": "Example Region",
"country": "XY",
"loc": "12.3456,-1.2345",
"postal": "XXX",
"org": "ASXXXX Example Organisation"
});