Re:The Awk Programming Language (1988) [pdf]
by Stratoscope on Thursday May 24, 2018 @02:33AM
(#17141552)
Awk did have this reputation of hard-to-read one liners, but it was also always possible to write readable code in it much as you would do in any language.
My favorite bit of Awk code that I ever wrote was this print formatting program for the HP LaserJet II:
It printed source code in a "2-up" format, with two pages printed side by side in landscape mode. It looked for the kind of separators that I and many people were fond of back in those days (the source code is a good example) and converted those to graphic boxes. And it tried to be smart about things like breaking pages before a comment box, not after.
I wish I still have a sample printout handy. For 300 lines of what I thought was fairly cleanly written Awk code, it made some nicely formatted printouts.
My favorite bit of Awk code that I ever wrote was this print formatting program for the HP LaserJet II:
https://github.com/geary/awk/blob/master/LJPII.AWK
It printed source code in a "2-up" format, with two pages printed side by side in landscape mode. It looked for the kind of separators that I and many people were fond of back in those days (the source code is a good example) and converted those to graphic boxes. And it tried to be smart about things like breaking pages before a comment box, not after.
I wish I still have a sample printout handy. For 300 lines of what I thought was fairly cleanly written Awk code, it made some nicely formatted printouts.