How can I remove any white space if any after parsing from JSON?
whereami -r
Parse result without sed.
{
"ip": "95.16.15.10",
"country_code": "US",
"country_name": "United States",
"region_code": "NY",
"region_name": "New York",
"city": "The Bronx",
"zip_code": "10473",
"time_zone": "America/New_York",
"latitude": 40.822,
"longitude": -73.86,
"metro_code": 501
}
Working one but with space.
whereami -r | sed -rn 's/(^.*city": ")(.*)(".*$)/\2/p'
The Bronx
Sort of working JSON result using sed -rn 's/(^.*city": ")(.*)(".*$)/\2/;s/ //p'
"ip": "95.16.15.10",
"country_code": "US",
"country_name": "United States",
"region_code": "NY",
"region_name": "New York",
TheBronx
"zip_code": "10473",
"time_zone": "America/New_York",
"latitude": 40.822,
"longitude": -73.86,
"metro_code": 501
What I'm trying to accomplished
TheBronx