What is 3q?

3q is a CGI script that executes awk code that is embedded into HTML files on your web server. To be more precise 3q

Here is an example: hello.3q and it's source code, and the lib file sqrt.awk.

How is this working?

3q is itself an awk script so there must be a trick. First 3q reads the XML file and converts this into a gawk script, static HTML/XML text is converted in printf() calls and source code inside <? awk ... ?> is passed as is. The resulting script code is then passed to a second gawk invocation as command line script. 3q relies heavily on proper shell quoting.

This idea is not new. Recently I found SQAwk on Sourceforge: The basic principle is the same (quoting then executing) but for some reason this project was abandoned.

Notice: It was comparable simple to modify 3q in a way that it puts the encoded script into a file which is then passed as argument to the executing gawk. Just make sure that the variable usefiles at the beginning of 3q is set to `1'.

Download the script: 3q.


Available Documentation

< dag | at | >