An xmlq that was really like jq would be fun, about 20 years ago.
An xmlq that was really like jq would be fun, about 20 years ago.
There is also `xmlstarlet` for parsing XML in a similar fashion.
Is this the yq? https://kislyuk.github.io/yq/ It does contain an 'xq', as a literal wrapper for jq, piping output into it after transcoding XML to JSON using xmltodict https://github.com/martinblech/xmltodict (which explodes xml into separate JSON data structures).
This is a bash one-liner! But TBF it really is a 'jq for xml'. I think it would be horrible for some things, but you could also do a lot of useful things painlessly.
If you have any other suggestions for parsing XML for exploratory purposes I'm very happy to hear them.
Just installed xq. It's nice just seeing the pretty-printed json output, so thanks for the pointer. Probably better than xmlstarlet for my usage, which just queries and outputs text, not xml. hmmm, that's probably true for most commandline uses...