3 ms·
I use awk for lots of things, including running simple nomerical models since its results are totally portable between OSes etc for my purposes. And I learnt a
by DamonHD 4y ago
I use awk for lots of things, including running simple nomerical models since its results are totally portable between OSes etc for my purposes.
And I learnt a new thing from this article, even though I have been using awk for decades... Functions. Yep!
- Stratoscope 4y agoYep, 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: https://github.com/geary/awk 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.
- shrubble 4y agoYou 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.
- DamonHD 4y agoOooooooo, that's how functions should be done. Here's a recent one of mine (albeit as usual embedded in a /bin/sh script) that I should try to functionify! https://www.earth.org.uk/script/BibTeX-to-HTML.sh https://www.earth.org.uk/script/BibTeX-to-HTML.sh Thanks!