The awk extraction and reporting language does not support the use of include files. However, it is possible to provide the name of more than one source file at the command line.
In awk, it is possible to provide the name of more than one source file at the command line by using multiple !-f switches:
awk -f one.awk -f two.awk
The functions defined in different source files will be visible from other scripts called from the same command line:
# one.awk BEGIN { sayhello() } # two.awk function sayhello() { print "Hello world" }
When more than one source file is provided at the command line, function names must be unique across all source files.
It is not permissible to pass the name of additional source files through a hashbang line, because there should not be more than one parameter on the hashbang line after the interpreter name. The following hashbang line will not work:
#!/usr/bin/awk -f two.awk