This chapter covers how to run
both POSIX-standard and
command-line options, and what
gawk do with nonoption arguments. It then
proceeds to cover how
gawk searches for
source files, reading standard input along with other files,
gawk’s environment variables,
gawk’s exit status, using include files, and
obsolete and undocumented options and/or features.
Many of the options and features described here are discussed in more detail later in the book; feel free to skip over things in this chapter that don’t interest you right now.
There are two ways to run
awk—with an explicit program or with one or more
program files. Here are templates for both of them; items enclosed in
[...] in these templates are optional:
In addition to traditional one-letter POSIX-style options,
gawk also supports GNU long options.
It is possible to invoke
an empty program:
awk '' datafile1 datafile2
Doing so makes little sense, though;
awk exits silently when given an empty program.
--lint has been specified on the command line,
gawk issues a warning that the program
Options begin with a dash and consist of a single character. GNU-style long options consist of two dashes and a keyword. The keyword can be abbreviated, as long as the abbreviation allows the option to be uniquely identified. If the option takes an argument, either ...