4 ms·
I'll just share my biggest Awk-based project here: A tool that creates HTML documentation from Markdown comments in your source code. It does essentially what
by wernsey 8y ago
I'll just share my biggest Awk-based project here: A tool that creates HTML documentation from Markdown comments in your source code.
It does essentially what Javadoc does, except it uses Markdown to format text, which I find much more pleasing to the eyes when you read source code.
The benefit of doing it in Awk is that if you want to use it in your project, you can just distribute a single script with your source code and add a two lines to your Makefile. Because of the ubiquity of Awk, you never have to worry whether people building your library has the correct tools installed.
It doesn't have all the features that more sophisticated tools like Doxygen provides, but I'm going to keep on doing the documentation for my small hobby projects this way.
[1] https://github.com/wernsey/d.awk https://github.com/wernsey/d.awk
- mauvehaus 8y agoIt is true that there exists an awk most everywhere, but I've been burned a few times by the discovery that nawk (Solaris (dating myself a bit there...)), gawk (many GNU/Linux distros), and mawk (some GNU/Linux distros? Don't know where I ran into it, but I have in the last couple of years) all have subtle incompatibilities around the edges. As I recall, gawk in particular has some extensions that are explicitly a superset of the standard funcionality. Which is great if you're only targeting gawk and know about it. It's less great if you think you're only targeting gawk, and discover later on that there's a system with a different awk you need to support. Your project looks neat, by the way. I'm looking forward to taking a closer look.
- wernsey 8y agoYes, there are differences. I used only standard awk facilities, and tested my project with gawk, mawk and nawk. I've also been burned when I discovered that Raspbian ships with an older version of mawk that did something differently in the way it processed regexen that caused my script to break.
- kazinator 8y agoOn the other hand, there is a POSIX standard, which you can use as a rough guide to write portable Awk if you suspect portable Awk is needed.
- danmg 8y agoVery cool. But, are there environments which have awk that don't have perl5? Even most commercial unices back in the late 90s shipped some kind of perl.