gawk—Pattern scanning and processing language
gawk [ POSIX or GNU style options ] –f program-file [ –– ] file …
gawk [ POSIX or GNU style options ] [ –– ] program-text file …
gawk is the GNU Project’s implementation of the awk programming language. It conforms to the definition of the language in the 1003.2 Command Language and Utilities Standard. This version
The command line consists of options to gawk itself, the awk program text (if not supplied via the –
gawk options may be either the traditional one-letter
Following the standard, gawk-specific options are supplied via arguments to the –W option. Multiple –W options may be supplied, or multiple arguments may be supplied together if they are separated by commas, or enclosed in quotes and separated by whitespace.
gawk accepts the following options:
|–F fs, ––field-separator=fs||Use fs for the input field separator (the value of the FS-predefined variable).|
|–v var=val, ––assign=var=val||Assign the value
|–f program-file, ––file=program-file||Read the awk program source from the file program-file, instead of from the first command-line argument. Multiple –f (or ––file) options may be used.|
|–mf=NNN, –mr=NNN||Set various memory limits to the value NNN. The f flag sets the maximum number of fields, and the r flag sets the maximum record size. These two flags and
||Run in compatibility mode. In compatibility mode, gawk behaves identically to awk; none of the GNU-specific extensions are recognized. See “GNU Extensions,” later in this manual page, for more information.|
|–W copyleft, –W copyright, ––copyleft, ––copyright||Print the short version of the GNU copyright information message on the error output.|
||Print a relatively short summary of the available options on the error output. Per the GNU Coding Standards, these options cause an immediate, successful exit.|
|–W lint, ––lint||Provide warnings about constructs that are dubious or nonportable to other awk implementations.|
||This turns on compatibility mode, with the following additional restrictions:\x escape sequences are not recognized.
The operators ** and **= cannot be used in place of ˆ and ˆ=.
|–W source=program-text, ––source=program-text||Use program-text as awk program source code. This option allows the easy intermixing of library functions (used via the –f and ––file options) with source code entered on the command line. It is intended primarily for medium to large awk programs used in shell scripts.
The –W source=
|–W version, ––version||Print version information for this particular copy of gawk on the error output. This is useful mainly for knowing if the current copy of gawk on your system is up-to-date with respect to whatever the Free Software Foundation is distributing. Per the GNU Coding Standards, these options cause an immediate, successful exit.|
|––||Signal the end of options. This is useful to allow further arguments to the awk program itself to start with a –. This is mainly for consistency with the argument-parsing convention used by most other programs.|
In compatibility mode, any other options are flagged as