|
|
|
|
|
by Arnavion
2012 days ago
|
|
Based on your description, it sounds like: <file.json jq '.. | .fileURL? | select(startswith("http://"))' -r
... would've done the job?Or, if you can't remember `startswith`: <file.json jq '.. | .fileURL?' -r | grep '^http://'
|
|
Right, the ".." part was hard to remember because it's something like:
and as you can see the field fileURL is actually an object with another field en-US (with a hyphen) so the jq becomes something like this:<file.json jq -r '.entries[] | .fields | select(.fileURL) | .fileURL["en-US"] | select(startswith("http://"))'
And later I had to do the same for other fields that ended in URL (websiteURL, etc.)
Anyway, gron made it simpler to get a quick summary of what I needed because it represents every node in the tree as a separate line that has the path in it, which is perfect for grep.
I still use jq more than gron :-)