3 ms·
The pitfall is that JSON has zero guarantees for how often line breaks do and don't occur, and is often used to represent hierarchical data. Grepping for 'key:
by fragmede 5y ago
The pitfall is that JSON has zero guarantees for how often line breaks do and don't occur, and is often used to represent hierarchical data. Grepping for 'key: foo', and some liberal use of -A and -B may find you what you're looking for, but grep is simply the wrong tool for that job. (And how do you handle a key with newlines in it?) jq [0] is the right tool, but jq's syntax is it's own, and is harder to use (unless you use it regularly).
[0] https://stedolan.github.io/jq/ https://stedolan.github.io/jq/
- dylan604 5y agowhen all you have is a hammer, everything looks like a nail. i can see rudimentary attempts at trying to get some data on a system you might not have full control over and are just needing something. i'm sure we've all been logged into a remote system maintained by someone else. cavemen throwing rocks at the spaceship type scenarios.