<div dir="ltr"><div>Indeed json does require more parsing, but it's a standard and well supported format.  The semantics represented by the json are arbitrary, but at least the parsing is handled.</div><div><br></div><div>The tree|jq vs find example I gave just used the tool I had at hand to demonstrate json output.  It's a poor example, unless you're trying to teach people to not overthink a problem.  Thank you for the correction, and fwiw even though I could have jq do the sorting, I would likely just pipe it through sort anyway.  I still love the freedom of piping arbitrary data around, and even torturing it with awk.<br></div><div><br></div><div>Are you familiar with xpath?  JQ's syntax reminds me of that, but a bit saner.  You're welcome for nightmares brought forth by the mention of xpath.<br></div><div><br></div><div>Brian</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 12, 2022 at 6:19 PM Bob Proulx <<a href="mailto:bob@proulx.com">bob@proulx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Brian,<br>
<br>
Brian Grossman wrote:<br>
> Imagine bash friends with an option for more structure than arbitrarily<br>
> formatted text.  I would occasionally like an option to emit json from many<br>
> commands in order to avoid parsing.  As a poor example:<br>
><br>
>     tree -Jp -L 3 | jq -r '.. | objects | select( .type? == "file" ) |<br>
> .name | select( test( "[.]ini$" ))'<br>
><br>
> is kinda-sorta-almost equivalent to<br>
><br>
>     find -maxdepth 3 -type f -name \*.ini<br>
<br>
It is equivalent to  this though.<br>
<br>
    find . -maxdepth 3 -name '*.ini' -printf "%f\n"<br>
<br>
Note that to make them reproducible we would need to sort the outputs<br>
to ensure they have the same sort order for comparison.  "| sort" for<br>
both of them would be good.<br>
<br>
Since I don't work with jq everyday I find that set of commands<br>
mystifying.  I am sure it would make sense if I were to use it more.<br>
But isn't the json one requiring much more parsing?<br>
<br>
Bob<br>
</blockquote></div>