xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/longwrds.in (revision c3937c08b16d32677a7dc955a81325f2e7a61b5d)
GAWK 1 "May 28 1991" "Free Software Foundation" "Utility Commands"
NAME
gawk - pattern scanning and processing language
SYNOPSIS
gawk [ -W gawk-options ] [ -F\^ fs ] [ -v var = val ] -f program-file [ -\^- ] file .\^.\^.

gawk [ -W gawk-options ] [ -F\^ fs ] [ -v var = val ] [ -\^- ] program-text file .\^.\^.

DESCRIPTION
Gawk is the GNU Project's implementation of the AWK programming language. It conforms to the definition of the language in the \*(PX 1003.2 Command Language And Utilities Standard (draft 11). This version in turn is based on the description in "The AWK Programming Language" , by Aho, Kernighan, and Weinberger, with the additional features defined in the System V Release 4 version of \*(UX awk . Gawk also provides some GNU-specific extensions.

The command line consists of options to gawk itself, the AWK program text (if not supplied via the -f option), and values to be made available in the ARGC and ARGV pre-defined AWK variables.

OPTIONS

Gawk accepts the following options, which should be available on any implementation of the AWK language.

-F fs Use fs for the input field separator (the value of the FS predefined variable).

-v var\^=\^val Assign the value val , to the variable var , before execution of the program begins. Such variable values are available to the BEGIN block of an AWK program.

-f " program-file" Read the AWK program source from the file program-file , instead of from the first command line argument. Multiple -f options may be used.

-\^- 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 \*(PX programs.

Following the \*(PX 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 white space. Case is ignored in arguments to the -W option.

The -W option accepts the following arguments:

\w'copyright'u+1n compat Run in compatibility mode. In compatibility mode, gawk behaves identically to \*(UX awk ; none of the GNU-specific extensions are recognized.

0 copyleft

copyright Print the short version of the GNU copyright information message on the error output.

lint Provide warnings about constructs that are dubious or non-portable to other AWK implementations.

posix This turns on compatibility mode, with the following additional restrictions:

\w'\(bu'u+1n \ex escape sequences are not recognized.

The synonym func for the keyword function is not recognized.

The operators ** and **= cannot be used in place of ^ and ^= .

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.

Any other options are flagged as illegal, but are otherwise ignored.

AWK PROGRAM EXECUTION

An AWK program consists of a sequence of pattern-action statements and optional function definitions.

pattern { action statements }

function name(parameter list) { statements }

Gawk first reads the program source from the program-file (s) if specified, or from the first non-option argument on the command line. The -f option may be used multiple times on the command line. Gawk will read the program text as if all the program-file s had been concatenated together. This is useful for building libraries of AWK functions, without having to include them in each new AWK