Reputation: 294
I would like to extract a single values from the output of a json file.
curl cli.fyi/8.8.8.8
Outputs
{
"type": "IP Address",
"data": {
"organisation": "Google LLC",
"country": "United States",
"countryCode": "US",
"continent": "North America",
"latitude": "37.751",
"longitude": "-97.822"
}
}
I can run this:
curl cli.fyi/8.8.8.8 2>/dev/null | awk -F'"' '$2=="organisation"'
and it will output:
"organisation": "Google LLC",
How can I get only Google LLC
?
Upvotes: 2
Views: 2207