1GAWK(1) Utility Commands GAWK(1)
2
3
4
6 gawk - pattern scanning and processing language
7
9 gawk [ POSIX or GNU style options ] -f program-file [ -- ] file ...
10 gawk [ POSIX or GNU style options ] [ -- ] program-text file ...
11
12 pgawk [ POSIX or GNU style options ] -f program-file [ -- ] file ...
13 pgawk [ POSIX or GNU style options ] [ -- ] program-text file ...
14
16 Gawk is the GNU Project's implementation of the AWK programming lan‐
17 guage. It conforms to the definition of the language in the POSIX
18 1003.1 Standard. This version in turn is based on the description in
19 The AWK Programming Language, by Aho, Kernighan, and Weinberger, with
20 the additional features found in the System V Release 4 version of UNIX
21 awk. Gawk also provides more recent Bell Laboratories awk extensions,
22 and a number of GNU-specific extensions.
23
24 Pgawk is the profiling version of gawk. It is identical in every way
25 to gawk, except that programs run more slowly, and it automatically
26 produces an execution profile in the file awkprof.out when done. See
27 the --profile option, below.
28
29 The command line consists of options to gawk itself, the AWK program
30 text (if not supplied via the -f or --file options), and values to be
31 made available in the ARGC and ARGV pre-defined AWK variables.
32
34 Gawk options may be either traditional POSIX one letter options, or
35 GNU-style long options. POSIX options start with a single “-”, while
36 long options start with “--”. Long options are provided for both GNU-
37 specific features and for POSIX-mandated features.
38
39 Following the POSIX standard, gawk-specific options are supplied via
40 arguments to the -W option. Multiple -W options may be supplied Each
41 -W option has a corresponding long option, as detailed below. Argu‐
42 ments to long options are either joined with the option by an = sign,
43 with no intervening spaces, or they may be provided in the next command
44 line argument. Long options may be abbreviated, as long as the abbre‐
45 viation remains unique.
46
48 Gawk accepts the following options, listed by frequency.
49
50 -F fs
51 --field-separator fs
52 Use fs for the input field separator (the value of the FS prede‐
53 fined variable).
54
55 -v var=val
56 --assign var=val
57 Assign the value val to the variable var, before execution of
58 the program begins. Such variable values are available to the
59 BEGIN block of an AWK program.
60
61 -f program-file
62 --file program-file
63 Read the AWK program source from the file program-file, instead
64 of from the first command line argument.