2 ms·
It's not you; parsing line-based text is fundamentally simpler than parsing structured data like JSON, especially nested JSON. It's just a lot easier to reason
by arp242 3y ago
It's not you; parsing line-based text is fundamentally simpler than parsing structured data like JSON, especially nested JSON. It's just a lot easier to reason about, and a lot easier to split up in smaller chunks, too. Who hasn't ended up with something like:
cmd | sed | grep | sed | grep
Each bit gets you closer what you want in small easy-to-understand steps, making it fairly easy to develop. And for things you only do once or twice, who cares as long as it works, right? I find that's a lot harder to do with jq. I feel this is a problem waiting for a better solution (and gron isn't it).
- fuzztester 3y ago>Who hasn't ended up with something like: > cmd | sed | grep | sed | grep And the decorate-sort-undecorate pattern: https://en.m.wikipedia.org/wiki/Decorate-sort-undecorate https://en.m.wikipedia.org/wiki/Decorate-sort-undecorate and the related Schwartzian transform: https://en.m.wikipedia.org/wiki/Schwartzian_transform https://en.m.wikipedia.org/wiki/Schwartzian_transform (The former redirects to the latter.)
- lttlrck 3y agoI end up with that kind of thing frequently, I'd like an optimizer though because I'm sure I'm certainly missing some deeper flag/regex/... knowledge.
- arp242 3y agoI probably have deeper knowledge of this kind of thing than most, and in most cases I found that doing a "crude" low-cognitive approach is better than spending brain cycles and effort on a "clever" high-cognitive approach.