AWK - Self-contained AWK Scripts

Self-contained AWK Scripts

On Unix-like operating systems self-contained AWK scripts can be constructed using the "shebang" syntax.

For example, a script called hello.awk that prints the string Hello, world! may be built by creating a file named hello.awk containing the following lines:

#!/usr/bin/awk -f BEGIN { print "Hello, world!" }

The -f tells awk that the argument that follows is the file to read the AWK program from.

Read more about this topic:  AWK