Sources are available here
http://sourceforge.net/projects/runawk
http://freshmeat.net/projects/runawk
What is runawk:
RUNAWK is a small wrapper for AWK interpreter that helps to write the
standalone programs in AWK. It provides MODULES for AWK similar to
PERL's "use" command and other powerful features. Dozens of ready to
use modules are also provided.
Major changes in this release:
Lots of demo programs for most runawk modules were created and
they are in examples/ subdirectory now.
New MEGA module ;-) power_getopt.awk
See the documentation and demo program examples/demo_power_getopt.
It makes options handling REALLY easy.
New modules:
embed_str.awk
has_suffix.awk
has_prefix.awk
readfile.awk
modinfo.awk
Minor fixes and improvements in dirname.awk and basename.awk.
Now they are fully compatible with dirname(1) and basename(1)
RUNAWK sets the following environment variables for the child awk
subprocess:
RUNAWK_MODC - A number of modules (-f filename) passed to AWK
RUNAWK_MODV_<n> - Full path to the module #n,
where n is in [0..RUNAWK_MODC) range.
RUNAWK sets RUNAWK_ART_STDIN environment variable for the child awk
subprocess to 1 if additional/artificial `-' was added to the list
to awk's arguments.
Makefile:
bmake-ism were removed. Now Makefile is fully compatible with
FreeBSD make.
CLEANFILES target is used instead of hand-made rules
Minor fix in 'test_all' target
--
Best regards, Aleksey Cheusov.
The most powerful feature of this release is power_getopt.awk module.
It provides very powerful and very easy way to handle options.
Everything is in usage message, you should do anything at all.
I think example below is easy.
-----------------------------------------------------------------
0 tmp>cat 1.awk
#!/usr/bin/env runawk
#use "power_getopt.awk"
#.begin-str help
# power_getopt - program demonstrating a power of power_getopt.awk module
# usage: power_getopt [OPTIONS]
# OPTIONS:
# -h|--help display this screen
# -f|--flag flag
# --long-flag long flag only
# -s short flag only
# =F|--FLAG <value> flag with value
#.end-str
BEGIN {
print "f --- " getarg("f")
print "flag --- " getarg("flag")
print "long-flag --- " getarg("long-flag")
print "s --- " getarg("s")
print "F --- " getarg("F", "default1")
print "FLAG --- " getarg("FLAG", "default2")
exit 0
}
-----------------------------------------------------------------
0 tmp>./1.awk
f --- 0
flag --- 0
long-flag --- 0
s --- 0
F --- default1
FLAG --- default2
-----------------------------------------------------------------
0 tmp>./1.awk -h
power_getopt - program demonstrating a power of power_getopt.awk module
usage: power_getopt [OPTIONS]
OPTIONS:
-h|--help display this screen
-f|--flag flag
--long-flag long flag only
-s short flag only
-F|--FLAG <value> flag with value
-----------------------------------------------------------------
0 tmp>./1.awk -f
f --- 1
flag --- 1
long-flag --- 0
s --- 0
F --- default1
FLAG --- default2
-----------------------------------------------------------------
0 tmp>./1.awk -F value
f --- 0
flag --- 0
long-flag --- 0
s --- 0
F --- value
FLAG --- value
-----------------------------------------------------------------
0 tmp>./1.awk --FLAG=value
f --- 0
flag --- 0
long-flag --- 0
s --- 0
F --- value
FLAG --- value
-----------------------------------------------------------------