About awk.info
» table of contents
» featured topics
» page tags
|
|
|
|
|
|
Mar 01: Michael Sanders demos an X-windows GUI for AWK.
Mar 01: Awk100#24: A. Lahm and E. de Rinaldis' patent search, in AWK
Feb 28: Tim Menzies asks this community to write an AWK cookbook.
Feb 28: Arnold Robbins announces a new debugger for GAWK.
Feb 28: Awk100#23: Premysl Janouch offers a IRC bot, In AWK
Feb 28: Updated: the AWK FAQ
Feb 28: Tim Menzies offers a tiny content management system, in Awk.
Jan 31: Comment system added to awk.info. For example, see discussion bottom of ?keys2awk
Jan 31: Martin Cohen shows that Gawk can handle massively long strings (300 million characters).
Jan 31: The AWK FAQ is being updated. For comments/ corrections/ extensions, please mail tim@menzies.us
Jan 31: Martin Cohen finds Awk on the Android platform.
Jan 31: Aleksey Cheusov released a new version of runawk.
Jan 31: Hirofumi Saito contributes a candidate Awk mascot.
Jan 31: Michael Sanders shows how to quickly build an AWK GUI for windows.
Jan 31: Hyung-Hwan Chung offers QSE, an embeddable Awk Interpreter.
This web site is a front end to a repository of Awk code. The site, and the code, is maintained by the international awk community (which includes you) so there are many ways you can contribute:
Using this logo, link to http://awk.info:
(By the way, our current logo is pretty lame. Want to contribute a better one? Please, be our guest!)
When writing a page, please follow these guidelines:
1 2 3 4 5 6 7
012345678901234567890123456789012345678901234567890123456789012345678901234567890
To contribute code, zip up the directory and mail it to
All function and file names are global to our code so please ensure your new function/file name does not clobber an old one.
Optionally, you might considering adding:
In the language of this site, a function file is a 100% standalone file containing one or more functions with no dependancies on other files. Note that if your function file depends on other files, then it becomes a package (see below).
Functions are stored in a file caled myfunc.awk.
In the language of this site, a package is a file that depends on other files (and the other files may depend on yet others, recursively).
Following a recent discussion in comp.lang.awk, we say that these dependancies are commented with
#use file.awk
where file.awk is some file (e.g. a file in the current directory).
Note that : file.awk will be loaded before the file containing the reference to #use file.awk.
The code that renders the awk.info web site can "pretty print" awk code. For example:
To enable that pretty print, add some html syntax inside your code and apply the following conventions.
Note that if you want to see your "looking pretty", then you could could see how it looks using our preview tool:
http://awk.info/?awk:urlWithoutHTTPprefix
For exmaple, the file http://menzies.us/tmp/xx.awk can be previewed using http://awk.info/?awk:menzies.us/tmp/xx.awk
Once you've got it "looking pretty", please consider contributing that code to awk.info, so our code library can grow. To do so, either email mail@awk.info with the URL of your pretty code or zip up the files and email them across.
The first paragraph of the file will be ignored. Use this first para for copyright notices or comments about down-in-the weeds trivia. Note: the first para ends with one blank line.
The next paragraph should start with
#.H1 <join>Title</join>
The code could should be topped and tailed as follows:
#<pre> code #</pre>
All other comment lines should start with a single "#" at front-of-line. These comment characters will be stripped away by the awk.info renderer.
Awk.info's renderer adopts the following html shorthand. If a line starts with
#.WORD other words
this this is replaced with
<WORD> other words</WORD>
If no other words follow #.WORD then the line becomes just <WORD>
Awk.info's renderer supports a few HTML extensions:
That's it. Now you can pretty print your code on the web just be adding a little html in the comments.
Ideally, all code in our code repository comes with unit tests:
Accordingly code offered to this site can contain unit tests, using the methods described in this page.
But before going on, we stress that awk.info gratefully accepts awk contributions in any form. That is, including unit tests with code is optional.
If your code is in directory yourcode then create a sub-directory yourcode/eg
Write a test in a file yourcode/eg/yourtest. Divide that test into two parts:
# assumes
# - the LAWKER trunk has been checked out and
# - .bash_profile contains: export Lawker="$HOME/svns/lawker/fridge"
. $Lawker/lib/bash/setup
gawk -f join.awk --source '
BEGIN { split("tim tom tam",a)
print join(a,2)
}'
Write the expected output of that test case in yourcode/eg/yourtest.out
The above file conventions mean that an automatic tool can run over the entire code base and perform a regression test (checking if all the tests generate all the *.out files.
Another advantage of the above scheme is that you can use the tests to document your code.
To show the test case, add the following into your .awk file:
#.BODY yourcode/eg/yourtest #.CODE yourcode/eg/yourtest.out
Then zip the directory yourcode (including yourcode/eg) and send it to awk.info. Once we install those files on our site then when awk.info displays that file, the test case trivia is hidden and the users only see the essential details. For an example of this, see http://awk.info/?gawk/array/join.awk.
blog comments powered by Disqus