11.1 Running the Example Programs

To run a given program, you would typically do something like this:

awk -f program -- options files

Here, program is the name of the awk program (such as cut.awk), options are any command-line options for the program that start with a ‘-’, and files are the actual data files.

If your system supports the ‘#!’ executable interpreter mechanism (see Executable awk Programs), you can instead run your program directly:

cut.awk -c1-8 myfiles > results

If your awk is not gawk, you may instead need to use this:

cut.awk -- -c1-8 myfiles > results