Hacker Newsnew | past | comments | ask | show | jobs | submitlogin




I would say that lots of people use jq. But it’s not really awk-like.

You could probably use gron with awk pretty easily, since gron stands for “greppable json”.

But I also wonder how an awk with native json support would look like.


Food for thought: have a look at this paper[0] about structural regular expressions. The author (Rob Pike) sketches in the last section an awk-support. I remember using such regexps a while ago to tweak indented JSON and JSON-like data (the indentation allowed to loop on hashes easily).

An awk with json support would for the most part need to be able to loop on hashes and arrays, and provide ways to travel in-depth. So far regular awk can travel through arrays (line-separator), and "in-depth" (e.g. nested "arrays") via regular loops & cie. Probably easier to think about it with a few concrete examples though.

[0]: http://doc.cat-v.org/bell_labs/structural_regexps/se.pdf




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: