Yep, functions! I used to write a fair amount of Awk code back in the late '80s and early '90s. I treated Awk as a "real" programming language and tried to make the code nice and readable. This of course involved a lot of use of functions.
I only have a couple of surviving examples of the code from back then, but here they are for the curious:
LJPII.AWK is probably the best example. It made a nicely formatted printout of source code on my HP LaserJet II printer. I wish I had one of the printouts it generated, but they are long gone.
Hmm... I wonder if my Brother printer supports the old LaserJet II control codes? Or maybe there is an emulator online?
The code was written for Thompson Awk (TAWK), so some bits would need to be adapted to modern Awks.
You can check if the Brother printer supports PCL which it likely does. Somewhere online will be an explanation of the differences between gnu awk and the version you used.
I only have a couple of surviving examples of the code from back then, but here they are for the curious:
https://github.com/geary/awk
LJPII.AWK is probably the best example. It made a nicely formatted printout of source code on my HP LaserJet II printer. I wish I had one of the printouts it generated, but they are long gone.
Hmm... I wonder if my Brother printer supports the old LaserJet II control codes? Or maybe there is an emulator online?
The code was written for Thompson Awk (TAWK), so some bits would need to be adapted to modern Awks.