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