I want to use grep to get a number from a JSON file For example, I want to get the 1.0872 from this:
{"base":"EUR","date":"2016-03-01","rates":{"USD":1.0872}}
Using
grep "USD" rates
gives out the whole line
{"base":"EUR","date":"2016-03-01","rates":{"USD":1.0872}}
I just want to display 1.0872.
I tried using a regex but it doesn't work (probably an error on my part since I've never done this before):
grep -oP '(?<="USD"\:)\w+' file