I\'d like to execute an gawk script with --re-interval
using a shebang. The \"naive\" approach of
#!/usr/bin/gawk --re-interval -f
... awk scri
Why not use bash
and gawk
itself, to skip past shebang, read the script, and pass it as a file to a second instance of gawk [--with-whatever-number-of-params-you-need]
?
#!/bin/bash
gawk --re-interval -f <(gawk 'NR>3' $0 )
exit
{
print "Program body goes here"
print $1
}
(-the same could naturally also be accomplished with e.g. sed
or tail
, but I think there's some kind of beauty depending only on bash
and gawk
itself;)