4 ms·
Sorry, I have removed the list of awk replacements for other languages from that comment because I thought it wasn't the right place for it in the thread. I'll
by networked 3y ago
Sorry, I have removed the list of awk replacements for other languages from that comment because I thought it wasn't the right place for it in the thread. I'll just post it here.
- Common Lisp: https://github.com/sharplispers/clawk https://github.com/sharplispers/clawk
- Haskell: https://github.com/gelisam/hawk https://github.com/gelisam/hawk
- Racket: https://gitlab.com/xgqt/racket-rawk https://gitlab.com/xgqt/racket-rawk
- Tcl: https://wiki.tcl-lang.org/page/owh+%2D+a+fileless+tclsh https://wiki.tcl-lang.org/page/owh+%2D+a+fileless+tclsh (disclosure: the page links to my fork)
One use for an awk replacement is emitting more structured data. I have used my fork of owh a few times to emit JSON after awk-style parsing. I know GNU Awk can generate JSON with https://www.gnu.org/software/gawk/manual/html_node/gawkextlib.html https://www.gnu.org/software/gawk/manual/html_node/gawkextli..., but I haven't tried it.
- cb321 3y agoNo problem. It might also bear mentioning that if one is willing to learn more specialized tools, even less key-downing is possible, such as (using https://github.com/c-blake/bu/blob/main/doc/cols.md https://github.com/c-blake/bu/blob/main/doc/cols.md): grep ^[A-Za-z]|cols 2 You just lose that row number in the original input coordinates feature of Ben's example which could probably be recovered with `grep -n` & `cols -d' :'`, etc., etc. In exchange, you can say `cols 2:5` to get a block of columns trivially. And then, of course, once you have any oft-repeated atom you can save it in a tiny script/etc. A lot of these choices come down to atom discovery & how willing/facile someone is juggling/remembering syntax/sub-languages. In my experience, willingness tracks facility and both are highly variable distributions over the human population.