3 ms·
> `curl ... | jq . | awk '...'` Uhm, jq _is_ as powerful (more) as awk. You can use jq directly and skip awk. (I know, old habits die hard, and learning func
by cryptonector 1y ago
> `curl ... | jq . | awk '...'`
Uhm, jq _is_ as powerful (more) as awk. You can use jq directly and skip awk.
(I know, old habits die hard, and learning functional programming languages is not easy.)
- aktau 1y agoYes, I know. I should've taken a different example. But it's also realistic in a way. When I'm doing one-offs, I will sometimes take shortcuts like this. I know awk fairly well, and I know enough of jq that I know invoking jq . pretty prints the inbound json on multiple lines. While I know I could create a proper jq expression, the combo will get me there quicker. Similarly I'll sometimes do: $ awk '...' | grep | ... Because I'm too lazy to go back to the start of the awk invocation and add a match condition there. If I'm going to save it to a script, I'll clean it up. (And for jq, I gotta be honest that my starting point these days would probably be to show my contraption to an LLM and use its answer as a starting point, I don't use jq nearly enough to learn its language by memory.)