13 ms·
I have to say, that's the most readable and understandable Awk program I've seen. Does anyone know if there's a repository of similarly literate awk scripts?
by EdwardDiego 5y ago
I have to say, that's the most readable and understandable Awk program I've seen.
Does anyone know if there's a repository of similarly literate awk scripts?
- asicsp 5y agoCheck out https://github.com/e36freak/awk-libs https://github.com/e36freak/awk-libs
- baddate 5y agonice!
- yiyus 5y agoThere used to be very good examples in awk.info. The domain is on sale now, but you can get all the old content from archive.org and it still is very valid.
- patrec 5y agoHave a look at the classic "The AWK Programming Language" by the A, W, and K in awk. It's full of great examples. https://ia803404.us.archive.org/0/items/pdfy-MgN0H1joIoDVoIC7/The_AWK_Programming_Language.pdf https://ia803404.us.archive.org/0/items/pdfy-MgN0H1joIoDVoIC...
- OskarS 5y agoI’ve found that AWK is frequently surprisingly readable actually, as long as you understand the execution model. I think people tend to think of it (with some justification) as in the same vein as Perl, but it isn’t nearly as surface-level cryptic. The syntax is just “C-style” with dynamic typing and built in regular expressions. I have a couple of AWK scripts to handle my personal finances (basically, consuming various bank/credit card statements and turning them to Ledger files) and it’s just the perfect language for that kind of task. My scripts look fairly similar to the examples in the blog post, they also use the same state-machine trick. With the possible exception of Perl/Raku, it’s my favourite language for that kind of thing.
- rottc0dd 5y agoI don't know if this is idiomatic way of doing awk. It is just a port of a python script to awk. https://github.com/berry-thawson/diff2html https://github.com/berry-thawson/diff2html This is first attempt in writing awk script. Would like to know how readable it is. Edits : added a new line. changed some words.