When I needed to write self-contained AWK script that would process the same file each time it was invoked (say, from /proc filesystem), I did the following:
Code:
#!/usr/bin/awk -f
BEGIN {
# ARGV[0] is the filename of the script itself.
ARGV[1] = "/path/to/file"
# Set ARGV length.
ARGC = 2
}
This way it behaves as if the file was provided as command line argument.
Should work for more than one file, but I haven't tried that.