4 ms·
Would think jq[0] is more suitable if you're going to install a cli json parser. [0]: https://stedolan.github.io/jq/ https://stedolan.github.io/jq/
by kevinastone 10y ago
Would think jq[0] is more suitable if you're going to install a cli json parser.
[0]: https://stedolan.github.io/jq/ https://stedolan.github.io/jq/
- jsrn 10y agoHere is the command with jq instead of json_pp $ curl -sS 'https://www.google.com/complete/search?client=hp&hl=en&xhr=t&q=aurora' | jq . | gsed -nE '/<\/?b>/{s```g;s`"|,|^ *``g;p}' (see my other comment about gsed vs sed)
- eridius 10y agoHere's the above modified to work with BSD sed: curl -sS 'https://www.google.com/complete/search?client=hp&hl=en&xhr=t&q=aurora' | jq . | sed -nE '/<\/?b>/{s```g;s`"|,|^ *``g;p;}' (Edited to remove previous advice about inserting a newline)
- kevinastone 10y agoYou don't need sed, you can do it all in jq: curl -sS 'https://www.google.com/complete/search?client=hp&hl=en&xhr=t&q=aurora' | jq -r '.[1] | .[][0] | sub("</?b>"; ""; "gi")'