It is often useful to type a simple program at the command line for use within awk. An awk program can be supplied as an [[argument?]] of the awk command:
awk 'BEGIN {print "Hello World!"}'
An awk script can be started at the command line, by passing the script name as a parameter to the awk interpreter:
awk -f foobar.awk
As with other Unix scripts, an awk script can be started using a hashbang. However, because of the syntax of the awk command line, it is necessary to include a the -f switch in the hashbang line as follows:
#!/usr/bin/awk -f BEGIN { print "Hello World!" }