|
|
|
|
|
by __jal
3814 days ago
|
|
General greatness aside, I have to say that's the best quality awk code I've seen. Too many people treat writing awk like picking up after your dog - something to get done quickly, when you have to. Which leads to write-only line noise code, which leads to people treating awk like picking up... |
|
My favorite AWK program was probably my LaserJet II code listing program from 1991. I wrote this out of frustration with the terrible default listings I got when I printed source code. The AWK code did a "two-up" printout of source code: two pages of code per page of paper in landscape mode. It used a nice font and drew graphic boxes around the pages. I was in the habit of using separator lines like this in my code:
//-------------------------------------
So the program found these and changed them to graphic line separators. It also avoided splitting a function onto two pages if it could - it would leave whitespace at the bottom of a page instead, filled in with a faint dot pattern.
Somewhere I have a printout I made with this program; I was hoping to find it and scan it in to show what it looked like. I know it's here somewhere, but in the meantime the source code will have to do:
https://github.com/geary/awk/blob/master/LJPII.AWK
Of course, these days I hardly ever print out any code. But back then we printed everything.