"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "doc/gawk.1" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

gawk.1  (gawk-5.0.1.tar.xz):gawk.1  (gawk-5.1.0.tar.xz)
skipping to change at line 409 skipping to change at line 409
CASE has a non-zero value, then string comparisons and patte rn matching in rules, field CASE has a non-zero value, then string comparisons and patte rn matching in rules, field
splitting with FS and FPAT, record separating with RS, reg ular expression matching with ~ splitting with FS and FPAT, record separating with RS, reg ular expression matching with ~
and !~, and the gensub(), gsub(), index(), match(), patsplit( ), split(), and sub() built-in and !~, and the gensub(), gsub(), index(), match(), patsplit( ), split(), and sub() built-in
functions all ignore case when doing regular expression oper ations. NOTE: Array subscript- functions all ignore case when doing regular expression oper ations. NOTE: Array subscript-
ing is not affected. However, the asort() and asorti() funct ions are affected. ing is not affected. However, the asort() and asorti() funct ions are affected.
Thus, if IGNORECASE is not equal to zero, /aB/ matches all of the strings "ab", "aB", "Ab", Thus, if IGNORECASE is not equal to zero, /aB/ matches all of the strings "ab", "aB", "Ab",
and "AB". As with all AWK variables, the initial value of I GNORECASE is zero, so all regu- and "AB". As with all AWK variables, the initial value of I GNORECASE is zero, so all regu-
lar expression and string operations are normally case-sensit ive. lar expression and string operations are normally case-sensit ive.
LINT Provides dynamic control of the --lint option from within an AWK program. When true, gawk LINT Provides dynamic control of the --lint option from within an AWK program. When true, gawk
prints lint warnings. When false, it does not. When assigned prints lint warnings. When false, it does not. The values al
the string value "fatal", lint lowed for the --lint option may
warnings become fatal errors, exactly like --lint=fatal. Any also be assigned to LINT, with the same effects. Any other t
other true value just prints rue value just prints warnings.
warnings.
NF The number of fields in the current input record. NF The number of fields in the current input record.
NR The total number of input records seen so far. NR The total number of input records seen so far.
OFMT The output format for numbers, "%.6g", by default. OFMT The output format for numbers, "%.6g", by default.
OFS The output field separator, a space by default. OFS The output field separator, a space by default.
ORS The output record separator, by default a newline. ORS The output record separator, by default a newline.
PREC The working precision of arbitrary precision floating-point n umbers, 53 by default. PREC The working precision of arbitrary precision floating-point n umbers, 53 by default.
PROCINFO The elements of this array provide access to information abo PROCINFO The elements of this array provide access to information abou
ut the running AWK program. On t the running AWK program. On
some systems, there may be elements in the array, "group1" t some systems, there may be elements in the array, "group
hrough "groupn" for some n, 1" through "groupn" for some n,
which is the number of supplementary groups that the proce which is the number of supplementary groups that the process
ss has. Use the in operator to has. Use the in operator to
test for these elements. The following elements are guarante ed to be available: test for these elements. The following elements are guarante ed to be available:
PROCINFO["argv"] The command line arguments as received b y gawk at the C-language level. PROCINFO["argv"] The command line arguments as received b y gawk at the C-language level.
The subscripts start from zero. The subscripts start from zero.
PROCINFO["egid"] The value of the getegid(2) system call. PROCINFO["egid"] The value of the getegid(2) system call.
PROCINFO["errno"] The value of errno(3) when ERRNO is s et to the associated error mes- PROCINFO["errno"] The value of errno(3) when ERRNO is set to the associated error mes-
sage. sage.
PROCINFO["euid"] The value of the geteuid(2) system call. PROCINFO["euid"] The value of the geteuid(2) system call.
PROCINFO["FS"] "FS" if field splitting with FS is in ef fect, "FPAT" if field splitting PROCINFO["FS"] "FS" if field splitting with FS is in ef fect, "FPAT" if field splitting
with FPAT is in effect, "FIELDWIDTHS" if field splitting with FIELD- with FPAT is in effect, "FIELDWIDTHS" if field splitting with FIELD-
WIDTHS is in effect, or "API" if API inp ut parser field splitting is in WIDTHS is in effect, or "API" if API inp ut parser field splitting is in
effect. effect.
PROCINFO["gid"] The value of the getgid(2) system call. PROCINFO["gid"] The value of the getgid(2) system call.
PROCINFO["identifiers"] PROCINFO["identifiers"]
A subarray, indexed by the names of all identifiers used in the text of A subarray, indexed by the names of all identifiers used in the text of
the AWK program. The values indicate wh at gawk knows about the identi- the AWK program. The values indicate wh at gawk knows about the identi-
fiers after it has finished parsing th fiers after it has finished parsing the
e program; they are not updated program; they are not updated
while the program runs. For each identi while the program runs. For each ident
fier, the value of the element ifier, the value of the element
is one of the following: is one of the following:
"array" The identifier is an array. "array" The identifier is an array.
"builtin" The identifier is a built-in function. "builtin" The identifier is a built-in function.
"extension" The identifier is an extensi on function loaded via @load or "extension" The identifier is an extensi on function loaded via @load or
--load. --load.
"scalar" The identifier is a scalar. "scalar" The identifier is a scalar.
"untyped" The identifier is untyped (c ould be used as a scalar or "untyped" The identifier is untyped (could be used as a scalar or
array, gawk doesn't know yet ). array, gawk doesn't know yet ).
"user" The identifier is a user-def ined function. "user" The identifier is a user-def ined function.
PROCINFO["pgrpid"] The value of the getpgrp(2) system call. PROCINFO["pgrpid"] The value of the getpgrp(2) system call.
PROCINFO["pid"] The value of the getpid(2) system call. PROCINFO["pid"] The value of the getpid(2) system call.
PROCINFO["platform"] A string indicating the platform for which gawk was compiled. It is PROCINFO["platform"] A string indicating the platform for whi ch gawk was compiled. It is
one of: one of:
"djgpp", "mingw" "djgpp", "mingw"
Microsoft Windows, using either D JGPP, or MinGW, respectively. Microsoft Windows, using either D JGPP, or MinGW, respectively.
"os2" OS/2. "os2" OS/2.
"posix" "posix"
GNU/Linux, Cygwin, Mac OS X, and legacy Unix systems. GNU/Linux, Cygwin, Mac OS X, and legacy Unix systems.
"vms" OpenVMS or Vax/VMS. "vms" OpenVMS or Vax/VMS.
PROCINFO["ppid"] The value of the getppid(2) system call. PROCINFO["ppid"] The value of the getppid(2) system call.
PROCINFO["strftime"] The default time format string for str PROCINFO["strftime"] The default time format string for
ftime(). Changing its value strftime(). Changing its value
affects how strftime() formats time v affects how strftime() formats time valu
alues when called with no argu- es when called with no argu-
ments. ments.
PROCINFO["uid"] The value of the getuid(2) system call. PROCINFO["uid"] The value of the getuid(2) system call.
PROCINFO["version"] The version of gawk. PROCINFO["version"] The version of gawk.
The following elements are present if loading dynamic extensi ons is available: The following elements are present if loading dynamic extensi ons is available:
PROCINFO["api_major"] PROCINFO["api_major"]
The major version of the extension API. The major version of the extension API.
PROCINFO["api_minor"] PROCINFO["api_minor"]
The minor version of the extension API. The minor version of the extension API.
The following elements are available if MPFR support is compi led into gawk: The following elements are available if MPFR support is compi led into gawk:
PROCINFO["gmp_version"] PROCINFO["gmp_version"]
The version of the GNU GMP library used for arbitrary precision number support in The version of the GNU GMP library used for arbitr ary precision number support in
gawk. gawk.
PROCINFO["mpfr_version"] PROCINFO["mpfr_version"]
The version of the GNU MPFR library used for arbitr ary precision number support in The version of the GNU MPFR library used for arbitrary precision number support in
gawk. gawk.
PROCINFO["prec_max"] PROCINFO["prec_max"]
The maximum precision supported by the GNU MPFR lib rary for arbitrary precision The maximum precision supported by the GNU MPFR library for arbitrary precision
floating-point numbers. floating-point numbers.
PROCINFO["prec_min"] PROCINFO["prec_min"]
The minimum precision allowed by the GNU MPFR library for arbitrary precision float- The minimum precision allowed by the GNU MPFR library for arbitrary precision float-
ing-point numbers. ing-point numbers.
The following elements may set by a program to change gawk's behavior: The following elements may set by a program to change gawk's behavior:
PROCINFO["NONFATAL"] PROCINFO["NONFATAL"]
If this exists, then I/O errors for all redirections b ecome nonfatal. If this exists, then I/O errors for all redirections b ecome nonfatal.
PROCINFO["name", "NONFATAL"] PROCINFO["name", "NONFATAL"]
Make I/O errors for name be nonfatal. Make I/O errors for name be nonfatal.
PROCINFO["command", "pty"] PROCINFO["command", "pty"]
Use a pseudo-tty for two-way communication with comman d instead of setting up two Use a pseudo-tty for two-way communication with co mmand instead of setting up two
one-way pipes. one-way pipes.
PROCINFO["input", "READ_TIMEOUT"] PROCINFO["input", "READ_TIMEOUT"]
The timeout in milliseconds for reading data from inpu t, where input is a redirection The timeout in milliseconds for reading data from inpu t, where input is a redirection
string or a filename. A value of zero or less than zer o means no timeout. string or a filename. A value of zero or less than zer o means no timeout.
PROCINFO["input", "RETRY"] PROCINFO["input", "RETRY"]
If an I/O error that may be retried occurs when readin g data from input, and this If an I/O error that may be retried occurs when re ading data from input, and this
array entry exists, then getline returns -2 instead of following the default behavior array entry exists, then getline returns -2 instead of following the default behavior
of returning -1 and configuring input to return no fur of returning -1 and configuring input to return no f
ther data. An I/O error that urther data. An I/O error that
may be retried is one where errno(3) has the value may be retried is one where errno(3) has the value EA
EAGAIN, EWOULDBLOCK, EINTR, or GAIN, EWOULDBLOCK, EINTR, or
ETIMEDOUT. This may be useful in conjunction with PRO ETIMEDOUT. This may be useful in conjunction with PR
CINFO["input", "READ_TIMEOUT"] OCINFO["input", "READ_TIMEOUT"]
or in situations where a file descriptor has been or in situations where a file descriptor has been conf
configured to behave in a non- igured to behave in a non-
blocking fashion. blocking fashion.
PROCINFO["sorted_in"] PROCINFO["sorted_in"]
If this element exists in PROCINFO, then its value con If this element exists in PROCINFO, then its value co
trols the order in which array ntrols the order in which array
elements are traversed in for loops. Supporte elements are traversed in for loops. Supported
d values are "@ind_str_asc", values are "@ind_str_asc",
"@ind_num_asc", "@val_type_asc", "@val_str_asc", "@ val_num_asc", "@ind_str_desc", "@ind_num_asc", "@val_type_asc", "@val_str_asc", "@ val_num_asc", "@ind_str_desc",
"@ind_num_desc", "@val_type_desc", "@val_str_desc", "@ val_num_desc", and "@unsorted". "@ind_num_desc", "@val_type_desc", "@val_str_desc", "@ val_num_desc", and "@unsorted".
The value can also be the name (as a string) of any co mparison function defined as The value can also be the name (as a string) of any comparison function defined as
follows: follows:
function cmp_func(i1, v1, i2, v2) function cmp_func(i1, v1, i2, v2)
where i1 and i2 are the indices, and v1 and v2 are where i1 and i2 are the indices, and v1 and v2 are the
the corresponding values of the corresponding values of the
two elements being compared. It should return a numb two elements being compared. It should return a
er less than, equal to, or number less than, equal to, or
greater than 0, depending on how the elements of the a rray are to be ordered. greater than 0, depending on how the elements of the a rray are to be ordered.
ROUNDMODE The rounding mode to use for arbitrary precision arithm etic on numbers, by default "N" ROUNDMODE The rounding mode to use for arbitrary precision arithmetic on numbers, by default "N"
(IEEE-754 roundTiesToEven mode). The accepted values are: (IEEE-754 roundTiesToEven mode). The accepted values are:
"A" or "a" "A" or "a"
for rounding away from zero. These are only available if your version of the GNU for rounding away from zero. These are only avail able if your version of the GNU
MPFR library supports rounding away from zero. MPFR library supports rounding away from zero.
"D" or "d" for roundTowardNegative. "D" or "d" for roundTowardNegative.
"N" or "n" for roundTiesToEven. "N" or "n" for roundTiesToEven.
"U" or "u" for roundTowardPositive. "U" or "u" for roundTowardPositive.
"Z" or "z" for roundTowardZero. "Z" or "z" for roundTowardZero.
RS The input record separator, by default a newline. RS The input record separator, by default a newline.
RT The record terminator. Gawk sets RT to the input text that m atched the character or regular RT The record terminator. Gawk sets RT to the input text that m atched the character or regular
expression specified by RS. expression specified by RS.
RSTART The index of the first character matched by match(); 0 if no match. (This implies that RSTART The index of the first character matched by match(); 0 i f no match. (This implies that
character indices start at one.) character indices start at one.)
RLENGTH The length of the string matched by match(); -1 if no match. RLENGTH The length of the string matched by match(); -1 if no match.
SUBSEP The string used to separate multiple subscripts in array elem ents, by default "\034". SUBSEP The string used to separate multiple subscripts in array elem ents, by default "\034".
SYMTAB An array whose indices are the names of all currently defined global variables and arrays in SYMTAB An array whose indices are the names of all currently defined global variables and arrays in
the program. The array may be used for indirect access to re ad or write the value of a the program. The array may be used for indirect access to read or write the value of a
variable: variable:
foo = 5 foo = 5
SYMTAB["foo"] = 4 SYMTAB["foo"] = 4
print foo # prints 4 print foo # prints 4
The typeof() function may be used to test if an element in S YMTAB is an array. You may not The typeof() function may be used to test if an element in SY MTAB is an array. You may not
use the delete statement with the SYMTAB array, nor assign to elements with an index that is use the delete statement with the SYMTAB array, nor assign to elements with an index that is
not a variable name. not a variable name.
TEXTDOMAIN The text domain of the AWK program; used to find the loca lized translations for the pro- TEXTDOMAIN The text domain of the AWK program; used to find the localize d translations for the pro-
gram's strings. gram's strings.
Arrays Arrays
Arrays are subscripted with an expression between square brackets ([ and Arrays are subscripted with an expression between square brackets ([ a
]). If the expression is an nd ]). If the expression is an
expression list (expr, expr ...) then the array subscript is a string expression list (expr, expr ...) then the array subscript is a string co
consisting of the concatenation nsisting of the concatenation
of the (string) value of each expression, separated by the value of the S of the (string) value of each expression, separated by the value of the
UBSEP variable. This facility SUBSEP variable. This facility
is used to simulate multiply dimensioned arrays. For example: is used to simulate multiply dimensioned arrays. For example:
i = "A"; j = "B"; k = "C" i = "A"; j = "B"; k = "C"
x[i, j, k] = "hello, world\n" x[i, j, k] = "hello, world\n"
assigns the string "hello, world\n" to the element of the array x which is indexed by the string assigns the string "hello, world\n" to the element of the array x whic h is indexed by the string
"A\034B\034C". All arrays in AWK are associative, i.e., indexed by strin g values. "A\034B\034C". All arrays in AWK are associative, i.e., indexed by strin g values.
The special operator in may be used to test if an array has an index cons isting of a particular value: The special operator in may be used to test if an array has an index cons isting of a particular value:
if (val in array) if (val in array)
print array[val] print array[val]
If the array has multiple subscripts, use (i, j) in array. If the array has multiple subscripts, use (i, j) in array.
The in construct may also be used in a for loop to iterate over all the e lements of an array. However, The in construct may also be used in a for loop to iterate over all the elements of an array. However,
the (i, j) in array construct only works in tests, not in for loops. the (i, j) in array construct only works in tests, not in for loops.
An element may be deleted from an array using the delete statement. T he delete statement may also be An element may be deleted from an array using the delete statement. The delete statement may also be
used to delete the entire contents of an array, just by specifying the ar ray name without a subscript. used to delete the entire contents of an array, just by specifying the ar ray name without a subscript.
gawk supports true multidimensional arrays. It does not require that such arrays be ``rectangular'' as gawk supports true multidimensional arrays. It does not require that su ch arrays be ``rectangular'' as
in C or C++. For example: in C or C++. For example:
a[1] = 5 a[1] = 5
a[2][1] = 6 a[2][1] = 6
a[2][2] = 7 a[2][2] = 7
NOTE: You may need to tell gawk that an array element is really a subarra y in order to use it where gawk NOTE: You may need to tell gawk that an array element is really a subarra y in order to use it where gawk
expects an array (such as in the second argument to split()). You can do this by creating an element in expects an array (such as in the second argument to split()). You can do this by creating an element in
the subarray and then deleting it with the delete statement. the subarray and then deleting it with the delete statement.
Namespaces Namespaces
Gawk provides a simple namespace facility to help work around the fac t that all variables in AWK are Gawk provides a simple namespace facility to help work around the fact th at all variables in AWK are
global. global.
A qualified name consists of a two simple identifiers joined by a double colon (::). The left-hand A qualified name consists of a two simple identifiers joined by a do uble colon (::). The left-hand
identifier represents the namespace and the right-hand identifier is the variable within it. All simple identifier represents the namespace and the right-hand identifier is the variable within it. All simple
(non-qualified) names are considered to be in the ``current'' namespace; (non-qualified) names are considered to be in the ``current'' namespace
the default namespace is awk. ; the default namespace is awk.
However, simple identifiers consisting solely of uppercase letters are However, simple identifiers consisting solely of uppercase letters are fo
forced into the awk namespace, rced into the awk namespace,
even if the current namespace is different. even if the current namespace is different.
You change the current namespace with an @namespace "name" directive. You change the current namespace with an @namespace "name" directive.
The standard predefined builtin function names may not be used as namespa The standard predefined builtin function names may not be used as names
ce names. The names of addi- pace names. The names of addi-
tional functions provided by gawk may be used as namespace names or tional functions provided by gawk may be used as namespace names or as
as simple identifiers in other simple identifiers in other
namespaces. For more details, see GAWK: Effective AWK Programming. namespaces. For more details, see GAWK: Effective AWK Programming.
Variable Typing And Conversion Variable Typing And Conversion
Variables and fields may be (floating point) numbers, or strings, or both Variables and fields may be (floating point) numbers, or strings, or
. They may also be regular both. They may also be regular
expressions. How the value of a variable is interpreted depends upon its expressions. How the value of a variable is interpreted depends upon its
context. If used in a numeric context. If used in a numeric
expression, it will be treated as a number; if used as a string it will b e treated as a string. expression, it will be treated as a number; if used as a string it will b e treated as a string.
To force a variable to be treated as a number, add zero to it; to force i t to be treated as a string, To force a variable to be treated as a number, add zero to it; to forc e it to be treated as a string,
concatenate it with the null string. concatenate it with the null string.
Uninitialized variables have the numeric value zero and the strin g value "" (the null, or empty, Uninitialized variables have the numeric value zero and the string val ue "" (the null, or empty,
string). string).
When a string must be converted to a number, the conversion is accomplish When a string must be converted to a number, the conversion is accompli
ed using strtod(3). A number shed using strtod(3). A number
is converted to a string by using the value of CONVFMT as a format is converted to a string by using the value of CONVFMT as a format stri
string for sprintf(3), with the ng for sprintf(3), with the
numeric value of the variable as the argument. However, even though all numeric value of the variable as the argument. However, even though a
numbers in AWK are floating- ll numbers in AWK are floating-
point, integral values are always converted as integers. Thus, given point, integral values are always converted as integers. Thus, given
CONVFMT = "%2.2f" CONVFMT = "%2.2f"
a = 12 a = 12
b = a "" b = a ""
the variable b has a string value of "12" and not "12.00". the variable b has a string value of "12" and not "12.00".
NOTE: When operating in POSIX mode (such as with the --posix option), beware that locale settings may NOTE: When operating in POSIX mode (such as with the --posix option), bew are that locale settings may
interfere with the way decimal numbers are treated: the decimal separator of the numbers you are feeding interfere with the way decimal numbers are treated: the decimal separator of the numbers you are feeding
to gawk must conform to what your locale would expect, be it a comma (,) or a period (.). to gawk must conform to what your locale would expect, be it a comma (,) or a period (.).
Gawk performs comparisons as follows: If two variables are numeric, the Gawk performs comparisons as follows: If two variables are numeric, they
y are compared numerically. If are compared numerically. If
one value is numeric and the other has a string value that is a “numeric one value is numeric and the other has a string value that is a “numeri
string,” then comparisons are c string,” then comparisons are
also done numerically. Otherwise, the numeric value is converted to a st ring and a string comparison is also done numerically. Otherwise, the numeric value is converted to a st ring and a string comparison is
performed. Two strings are compared, of course, as strings. performed. Two strings are compared, of course, as strings.
Note that string constants, such as "57", are not numeric strings, they a re string constants. The idea Note that string constants, such as "57", are not numeric strings, they are string constants. The idea
of “numeric string” only applies to fields, getline input, FILENAME, ARGV elements, ENVIRON elements and of “numeric string” only applies to fields, getline input, FILENAME, ARGV elements, ENVIRON elements and
the elements of an array created by split() or patsplit() that are numeri c strings. The basic idea is the elements of an array created by split() or patsplit() that are nume ric strings. The basic idea is
that user input, and only user input, that looks numeric, should be treat ed that way. that user input, and only user input, that looks numeric, should be treat ed that way.
Octal and Hexadecimal Constants Octal and Hexadecimal Constants
You may use C-style octal and hexadecimal constants in your AWK program source code. For example, the You may use C-style octal and hexadecimal constants in your AWK program s ource code. For example, the
octal value 011 is equal to decimal 9, and the hexadecimal value 0x11 is equal to decimal 17. octal value 011 is equal to decimal 9, and the hexadecimal value 0x11 is equal to decimal 17.
String Constants String Constants
String constants in AWK are sequences of characters enclosed between d ouble quotes (like "value"). String constants in AWK are sequences of characters enclosed betwee n double quotes (like "value").
Within strings, certain escape sequences are recognized, as in C. These are: Within strings, certain escape sequences are recognized, as in C. These are:
\\ A literal backslash. \\ A literal backslash.
\a The “alert” character; usually the ASCII BEL character. \a The “alert” character; usually the ASCII BEL character.
\b Backspace. \b Backspace.
\f Form-feed. \f Form-feed.
\n Newline. \n Newline.
\r Carriage return. \r Carriage return.
\t Horizontal tab. \t Horizontal tab.
\v Vertical tab. \v Vertical tab.
\xhex digits \xhex digits
The character represented by the string of hexadecimal digits follo The character represented by the string of hexadecimal digits follow
wing the \x. Up to two follow- ing the \x. Up to two follow-
ing hexadecimal digits are considered part of the escape sequence. ing hexadecimal digits are considered part of the escape sequence.
E.g., "\x1B" is the ASCII ESC E.g., "\x1B" is the ASCII ESC
(escape) character. (escape) character.
\ddd The character represented by the 1-, 2-, or 3-digit sequence of oct al digits. E.g., "\033" is the \ddd The character represented by the 1-, 2-, or 3-digit sequence of octa l digits. E.g., "\033" is the
ASCII ESC (escape) character. ASCII ESC (escape) character.
\c The literal character c. \c The literal character c.
In compatibility mode, the characters represented by octal and hexadecima l escape sequences are treated In compatibility mode, the characters represented by octal and hexadecim al escape sequences are treated
literally when used in regular expression constants. Thus, /a\52b/ is eq uivalent to /a\*b/. literally when used in regular expression constants. Thus, /a\52b/ is eq uivalent to /a\*b/.
Regexp Constants Regexp Constants
A regular expression constant is a sequence of characters enclose d between forward slashes (like A regular expression constant is a sequence of characters enclosed b etween forward slashes (like
/value/). Regular expression matching is described more fully below; see Regular Expressions. /value/). Regular expression matching is described more fully below; see Regular Expressions.
The escape sequences described earlier may also be used inside constan t regular expressions (e.g., The escape sequences described earlier may also be used inside cons tant regular expressions (e.g.,
/[ \t\f\n\r\v]/ matches whitespace characters). /[ \t\f\n\r\v]/ matches whitespace characters).
Gawk provides strongly typed regular expression constants. These are Gawk provides strongly typed regular expression constants. These are writ
written with a leading @ symbol ten with a leading @ symbol
(like so: @/value/). Such constants may be assigned to scalars (variable (like so: @/value/). Such constants may be assigned to scalars (variab
s, array elements) and passed les, array elements) and passed
to user-defined functions. Variables that have been so assigned have regu lar expression type. to user-defined functions. Variables that have been so assigned have regu lar expression type.
PATTERNS AND ACTIONS PATTERNS AND ACTIONS
AWK is a line-oriented language. The pattern comes first, and then the AWK is a line-oriented language. The pattern comes first, and then the a
action. Action statements are ction. Action statements are
enclosed in { and }. Either the pattern may be missing, or the action ma enclosed in { and }. Either the pattern may be missing, or the action
y be missing, but, of course, may be missing, but, of course,
not both. If the pattern is missing, the action executes for every sin not both. If the pattern is missing, the action executes for every singl
gle record of input. A missing e record of input. A missing
action is equivalent to action is equivalent to
{ print } { print }
which prints the entire record. which prints the entire record.
Comments begin with the # character, and continue until the end of the li ne. Empty lines may be used to Comments begin with the # character, and continue until the end of the li ne. Empty lines may be used to
separate statements. Normally, a statement ends with a newline, however, this is not the case for lines separate statements. Normally, a statement ends with a newline, however, this is not the case for lines
ending in a comma, {, ?, :, &&, or ||. Lines ending in do or else also h ave their statements automati- ending in a comma, {, ?, :, &&, or ||. Lines ending in do or else also have their statements automati-
cally continued on the following line. In other cases, a line can be con tinued by ending it with a “\”, cally continued on the following line. In other cases, a line can be con tinued by ending it with a “\”,
in which case the newline is ignored. However, a “\” after a # is not sp ecial. in which case the newline is ignored. However, a “\” after a # is not sp ecial.
Multiple statements may be put on one line by separating them with a “;”. Multiple statements may be put on one line by separating them with a
This applies to both the “;”. This applies to both the
statements within the action part of a pattern-action pair (the usual c statements within the action part of a pattern-action pair (the usual cas
ase), and to the pattern-action e), and to the pattern-action
statements themselves. statements themselves.
Patterns Patterns
AWK patterns may be one of the following: AWK patterns may be one of the following:
BEGIN BEGIN
END END
BEGINFILE BEGINFILE
ENDFILE ENDFILE
/regular expression/ /regular expression/
relational expression relational expression
pattern && pattern pattern && pattern
pattern || pattern pattern || pattern
pattern ? pattern : pattern pattern ? pattern : pattern
(pattern) (pattern)
! pattern ! pattern
pattern1, pattern2 pattern1, pattern2
BEGIN and END are two special kinds of patterns which are not tested aga inst the input. The action BEGIN and END are two special kinds of patterns which are not tested against the input. The action
parts of all BEGIN patterns are merged as if all the statements had been written in a single BEGIN rule. parts of all BEGIN patterns are merged as if all the statements had been written in a single BEGIN rule.
They are executed before any of the input is read. Similarly, all the EN They are executed before any of the input is read. Similarly, all the
D rules are merged, and exe- END rules are merged, and exe-
cuted when all the input is exhausted (or when an exit statement is exe cuted when all the input is exhausted (or when an exit statement is execu
cuted). BEGIN and END patterns ted). BEGIN and END patterns
cannot be combined with other patterns in pattern expressions. BEGIN and END patterns cannot have miss- cannot be combined with other patterns in pattern expressions. BEGIN and END patterns cannot have miss-
ing action parts. ing action parts.
BEGINFILE and ENDFILE are additional special patterns whose actions are executed before reading the BEGINFILE and ENDFILE are additional special patterns whose actions are executed before reading the
first record of each command-line input file and after reading the last r ecord of each file. Inside the first record of each command-line input file and after reading the last r ecord of each file. Inside the
BEGINFILE rule, the value of ERRNO is the empty string if the file was o BEGINFILE rule, the value of ERRNO is the empty string if the file was op
pened successfully. Otherwise, ened successfully. Otherwise,
there is some problem with the file and the code should use nextfile to s there is some problem with the file and the code should use nextfile t
kip it. If that is not done, o skip it. If that is not done,
gawk produces its usual fatal error for files that cannot be opened. gawk produces its usual fatal error for files that cannot be opened.
For /regular expression/ patterns, the associated statement is exec For /regular expression/ patterns, the associated statement is executed
uted for each input record that for each input record that
matches the regular expression. Regular expressions are the same as thos matches the regular expression. Regular expressions are the same as th
e in egrep(1), and are summa- ose in egrep(1), and are summa-
rized below. rized below.
A relational expression may use any of the operators defined below in the section on actions. These A relational expression may use any of the operators defined below in the section on actions. These
generally test whether certain fields match certain regular expressions. generally test whether certain fields match certain regular expressions.
The &&, ||, and ! operators are logical AND, logical OR, and logical NOT The &&, ||, and ! operators are logical AND, logical OR, and logical NO
, respectively, as in C. They T, respectively, as in C. They
do short-circuit evaluation, also as in C, and are used for combining do short-circuit evaluation, also as in C, and are used for combining mo
more primitive pattern expres- re primitive pattern expres-
sions. As in most languages, parentheses may be used to change the order of evaluation. sions. As in most languages, parentheses may be used to change the order of evaluation.
The ?: operator is like the same operator in C. If the first pattern is The ?: operator is like the same operator in C. If the first pattern is
true then the pattern used for true then the pattern used for
testing is the second pattern, otherwise it is the third. Only one of t testing is the second pattern, otherwise it is the third. Only one of th
he second and third patterns is e second and third patterns is
evaluated. evaluated.
The pattern1, pattern2 form of an expression is called a range pattern. The pattern1, pattern2 form of an expression is called a range pattern
It matches all input records . It matches all input records
starting with a record that matches pattern1, and continuing until starting with a record that matches pattern1, and continuing until a r
a record that matches pattern2, ecord that matches pattern2,
inclusive. It does not combine with any other sort of pattern expression . inclusive. It does not combine with any other sort of pattern expression .
Regular Expressions Regular Expressions
Regular expressions are the extended kind found in egrep. They are compo sed of characters as follows: Regular expressions are the extended kind found in egrep. They are compo sed of characters as follows:
c Matches the non-metacharacter c. c Matches the non-metacharacter c.
\c Matches the literal character c. \c Matches the literal character c.
. Matches any character including newline. . Matches any character including newline.
^ Matches the beginning of a string. ^ Matches the beginning of a string.
$ Matches the end of a string. $ Matches the end of a string.
[abc...] A character list: matches any of the characters abc.... You m [abc...] A character list: matches any of the characters abc.... You
ay include a range of charac- may include a range of charac-
ters by separating them with a dash. To include a literal da ters by separating them with a dash. To include a literal das
sh in the list, put it first or h in the list, put it first or
last. last.
[^abc...] A negated character list: matches any character except abc.... [^abc...] A negated character list: matches any character except abc....
r1|r2 Alternation: matches either r1 or r2. r1|r2 Alternation: matches either r1 or r2.
r1r2 Concatenation: matches r1, and then r2. r1r2 Concatenation: matches r1, and then r2.
r+ Matches one or more r's. r+ Matches one or more r's.
r* Matches zero or more r's. r* Matches zero or more r's.
r? Matches zero or one r's. r? Matches zero or one r's.
(r) Grouping: matches r. (r) Grouping: matches r.
r{n} r{n}
r{n,} r{n,}
r{n,m} One or two numbers inside braces denote an interval expression . If there is one number in r{n,m} One or two numbers inside braces denote an interval express ion. If there is one number in
the braces, the preceding regular expression r is repeated n t imes. If there are two numbers the braces, the preceding regular expression r is repeated n t imes. If there are two numbers
separated by a comma, r is repeated n to m times. If there i s one number followed by a separated by a comma, r is repeated n to m times. If th ere is one number followed by a
comma, then r is repeated at least n times. comma, then r is repeated at least n times.
\y Matches the empty string at either the beginning or the end of a word. \y Matches the empty string at either the beginning or the end of a word.
\B Matches the empty string within a word. \B Matches the empty string within a word.
\< Matches the empty string at the beginning of a word. \< Matches the empty string at the beginning of a word.
\> Matches the empty string at the end of a word. \> Matches the empty string at the end of a word.
skipping to change at line 867 skipping to change at line 866
\W Matches any character that is not word-constituent. \W Matches any character that is not word-constituent.
\` Matches the empty string at the beginning of a buffer (string) . \` Matches the empty string at the beginning of a buffer (string) .
\' Matches the empty string at the end of a buffer. \' Matches the empty string at the end of a buffer.
The escape sequences that are valid in string constants (see String Const ants) are also valid in regular The escape sequences that are valid in string constants (see String Const ants) are also valid in regular
expressions. expressions.
Character classes are a feature introduced in the POSIX standard. A char Character classes are a feature introduced in the POSIX standard. A cha
acter class is a special nota- racter class is a special nota-
tion for describing lists of characters that have a specific attribute, tion for describing lists of characters that have a specific attribute, b
but where the actual characters ut where the actual characters
themselves can vary from country to country and/or from character set to themselves can vary from country to country and/or from character set
character set. For example, to character set. For example,
the notion of what is an alphabetic character differs in the USA and in F rance. the notion of what is an alphabetic character differs in the USA and in F rance.
A character class is only valid in a regular expression inside the brack ets of a character list. Char- A character class is only valid in a regular expression inside the bracke ts of a character list. Char-
acter classes consist of [:, a keyword denoting the class, and :]. The c haracter classes defined by the acter classes consist of [:, a keyword denoting the class, and :]. The c haracter classes defined by the
POSIX standard are: POSIX standard are:
[:alnum:] Alphanumeric characters. [:alnum:] Alphanumeric characters.
[:alpha:] Alphabetic characters. [:alpha:] Alphabetic characters.
[:blank:] Space or tab characters. [:blank:] Space or tab characters.
[:cntrl:] Control characters. [:cntrl:] Control characters.
[:digit:] Numeric characters. [:digit:] Numeric characters.
[:graph:] Characters that are both printable and visible. (A space is printable, but not visible, [:graph:] Characters that are both printable and visible. (A space is printable, but not visible,
while an a is both.) while an a is both.)
[:lower:] Lowercase alphabetic characters. [:lower:] Lowercase alphabetic characters.
[:print:] Printable characters (characters that are not control characte rs.) [:print:] Printable characters (characters that are not control characte rs.)
[:punct:] Punctuation characters (characters that are not letter, digits , control characters, or space [:punct:] Punctuation characters (characters that are not letter, digit s, control characters, or space
characters). characters).
[:space:] Space characters (such as space, tab, and formfeed, to name a few). [:space:] Space characters (such as space, tab, and formfeed, to name a few).
[:upper:] Uppercase alphabetic characters. [:upper:] Uppercase alphabetic characters.
[:xdigit:] Characters that are hexadecimal digits. [:xdigit:] Characters that are hexadecimal digits.
For example, before the POSIX standard, to match alphanumeric characte For example, before the POSIX standard, to match alphanumeric characters,
rs, you would have had to write you would have had to write
/[A-Za-z0-9]/. If your character set had other alphabetic characters in /[A-Za-z0-9]/. If your character set had other alphabetic characters in
it, this would not match them, it, this would not match them,
and if your character set collated differently from ASCII, this might no and if your character set collated differently from ASCII, this might not
t even match the ASCII alphanu- even match the ASCII alphanu-
meric characters. With the POSIX character classes, you can write /[[:al meric characters. With the POSIX character classes, you can write /[[:
num:]]/, and this matches the alnum:]]/, and this matches the
alphabetic and numeric characters in your character set, no matter what i t is. alphabetic and numeric characters in your character set, no matter what i t is.
Two additional special sequences can appear in character lists. The Two additional special sequences can appear in character lists. These
se apply to non-ASCII character apply to non-ASCII character
sets, which can have single symbols (called collating elements) that are sets, which can have single symbols (called collating elements) that are
represented with more than one represented with more than one
character, as well as several characters that are equivalent for c character, as well as several characters that are equivalent for coll
ollating, or sorting, purposes. ating, or sorting, purposes.
(E.g., in French, a plain “e” and a grave-accented “`” are equivalent.) (E.g., in French, a plain “e” and a grave-accented “`” are equivalent.)
Collating Symbols Collating Symbols
A collating symbol is a multi-character collating element enclosed A collating symbol is a multi-character collating element enclos
in [. and .]. For example, ed in [. and .]. For example,
if ch is a collating element, then [[.ch.]] is a regular express if ch is a collating element, then [[.ch.]] is a regular expressi
ion that matches this collating on that matches this collating
element, while [ch] is a regular expression that matches either c or h. element, while [ch] is a regular expression that matches either c or h.
Equivalence Classes Equivalence Classes
An equivalence class is a locale-specific name for a list of chara cters that are equivalent. The An equivalence class is a locale-specific name for a list of chara cters that are equivalent. The
name is enclosed in [= and =]. For example, the name e might b e used to represent all of “e”, name is enclosed in [= and =]. For example, the name e might be u sed to represent all of “e”,
“´”, and “`”. In this case, [[=e=]] is a regular expression that matches any of e, ´, or `. “´”, and “`”. In this case, [[=e=]] is a regular expression that matches any of e, ´, or `.
These features are very valuable in non-English speaking locales. The li These features are very valuable in non-English speaking locales. The l
brary functions that gawk uses ibrary functions that gawk uses
for regular expression matching currently only recognize POSIX character for regular expression matching currently only recognize POSIX character
classes; they do not recognize classes; they do not recognize
collating symbols or equivalence classes. collating symbols or equivalence classes.
The \y, \B, \<, \>, \s, \S, \w, \W, \`, and \' operators are specific to gawk; they are extensions based The \y, \B, \<, \>, \s, \S, \w, \W, \`, and \' operators are specific to gawk; they are extensions based
on facilities in the GNU regular expression libraries. on facilities in the GNU regular expression libraries.
The various command line options control how gawk interprets characters i n regular expressions. The various command line options control how gawk interprets characters i n regular expressions.
No options No options
In the default case, gawk provides all the facilities of POSIX regular expressions and the GNU In the default case, gawk provides all the facilities of POSIX reg ular expressions and the GNU
regular expression operators described above. regular expression operators described above.
--posix --posix
Only POSIX regular expressions are supported, the GNU operators are not special. (E.g., \w Only POSIX regular expressions are supported, the GNU operat ors are not special. (E.g., \w
matches a literal w). matches a literal w).
--traditional --traditional
Traditional UNIX awk regular expressions are matched. The GNU Traditional UNIX awk regular expressions are matched. The GNU ope
operators are not special, and rators are not special, and
interval expressions are not available. Characters described by interval expressions are not available. Characters described
octal and hexadecimal escape by octal and hexadecimal escape
sequences are treated literally, even if they represent regular ex pression metacharacters. sequences are treated literally, even if they represent regular ex pression metacharacters.
--re-interval --re-interval
Allow interval expressions in regular expressions, even if --tradi tional has been provided. Allow interval expressions in regular expressions, even if --tradi tional has been provided.
Actions Actions
Action statements are enclosed in braces, { and }. Action statements c Action statements are enclosed in braces, { and }. Action statements con
onsist of the usual assignment, sist of the usual assignment,
conditional, and looping statements found in most languages. The operat conditional, and looping statements found in most languages. The ope
ors, control statements, and rators, control statements, and
input/output statements available are patterned after those in C. input/output statements available are patterned after those in C.
Operators Operators
The operators in AWK, in order of decreasing precedence, are: The operators in AWK, in order of decreasing precedence, are:
(...) Grouping (...) Grouping
$ Field reference. $ Field reference.
++ -- Increment and decrement, both prefix and postfix. ++ -- Increment and decrement, both prefix and postfix.
skipping to change at line 977 skipping to change at line 976
+ - Addition and subtraction. + - Addition and subtraction.
space String concatenation. space String concatenation.
| |& Piped I/O for getline, print, and printf. | |& Piped I/O for getline, print, and printf.
< > <= >= == != < > <= >= == !=
The regular relational operators. The regular relational operators.
~ !~ Regular expression match, negated match. NOTE: Do not us ~ !~ Regular expression match, negated match. NOTE: Do not use a
e a constant regular expression constant regular expression
(/foo/) on the left-hand side of a ~ or !~. Only use one o (/foo/) on the left-hand side of a ~ or !~. Only use o
n the right-hand side. The ne on the right-hand side. The
expression /foo/ ~ exp has the same meaning as (($0 ~ /foo expression /foo/ ~ exp has the same meaning as (($0 ~ /foo/)
/) ~ exp). This is usually not ~ exp). This is usually not
what you want. what you want.
in Array membership. in Array membership.
&& Logical AND. && Logical AND.
|| Logical OR. || Logical OR.
?: The C conditional expression. This has the form expr1 ? expr 2 : expr3. If expr1 is true, ?: The C conditional expression. This has the form expr1 ? ex pr2 : expr3. If expr1 is true,
the value of the expression is expr2, otherwise it is expr3. Only one of expr2 and expr3 is the value of the expression is expr2, otherwise it is expr3. Only one of expr2 and expr3 is
evaluated. evaluated.
= += -= *= /= %= ^= = += -= *= /= %= ^=
Assignment. Both absolute assignment (var = value) and o perator-assignment (the other Assignment. Both absolute assignment (var = value) and operator-assignment (the other
forms) are supported. forms) are supported.
Control Statements Control Statements
The control statements are as follows: The control statements are as follows:
if (condition) statement [ else statement ] if (condition) statement [ else statement ]
while (condition) statement while (condition) statement
do statement while (condition) do statement while (condition)
for (expr1; expr2; expr3) statement for (expr1; expr2; expr3) statement
for (var in array) statement for (var in array) statement
skipping to change at line 1019 skipping to change at line 1018
{ statements } { statements }
switch (expression) { switch (expression) {
case value|regex : statement case value|regex : statement
... ...
[ default: statement ] [ default: statement ]
} }
I/O Statements I/O Statements
The input/output statements are as follows: The input/output statements are as follows:
close(file [, how]) Close file, pipe or coprocess. The optional how s close(file [, how]) Close file, pipe or coprocess. The optional how sh
hould only be used when closing ould only be used when closing
one end of a two-way pipe to a coprocess. It must one end of a two-way pipe to a coprocess. It must
be a string value, either "to" be a string value, either "to"
or "from". or "from".
getline Set $0 from the next input record; set NF, NR, FNR, RT. getline Set $0 from the next input record; set NF, NR, FNR, RT.
getline <file Set $0 from the next record of file; set NF, RT. getline <file Set $0 from the next record of file; set NF, RT.
getline var Set var from the next input record; set NR, FNR, RT . getline var Set var from the next input record; set NR, FNR, RT .
getline var <file Set var from the next record of file; set RT. getline var <file Set var from the next record of file; set RT.
command | getline [var] command | getline [var]
Run command, piping the output either into $0 or va r, as above, and RT. Run command, piping the output either into $0 or va r, as above, and RT.
command |& getline [var] command |& getline [var]
Run command as a coprocess piping the output eithe Run command as a coprocess piping the output either
r into $0 or var, as above, and into $0 or var, as above, and
RT. Coprocesses are a gawk extension. (The comman RT. Coprocesses are a gawk extension. (The com
d can also be a socket. See mand can also be a socket. See
the subsection Special File Names, below.) the subsection Special File Names, below.)
next Stop processing the current input record. Read next Stop processing the current input record. Read the
the next input record and start next input record and start
processing over with the first pattern in the AWK p processing over with the first pattern in the AWK
rogram. Upon reaching the end program. Upon reaching the end
of the input data, execute any END rule(s). of the input data, execute any END rule(s).
nextfile Stop processing the current input file. The next i nput record read comes from the nextfile Stop processing the current input file. The next i nput record read comes from the
next input file. Update FILENAME and ARGIND, reset FNR to 1, and start processing next input file. Update FILENAME and ARGIND, reset FNR to 1, and start processing
over with the first pattern in the AWK program . Upon reaching the end of the over with the first pattern in the AWK program. Up on reaching the end of the
input data, execute any ENDFILE and END rule(s). input data, execute any ENDFILE and END rule(s).
print Print the current record. The output record is ter minated with the value of ORS. print Print the current record. The output record is ter minated with the value of ORS.
print expr-list Print expressions. Each expression is separated by the value of OFS. The output print expr-list Print expressions. Each expression is separated b y the value of OFS. The output
record is terminated with the value of ORS. record is terminated with the value of ORS.
print expr-list >file Print expressions on file. Each expression is sepa rated by the value of OFS. The print expr-list >file Print expressions on file. Each expression is sepa rated by the value of OFS. The
output record is terminated with the value of ORS. output record is terminated with the value of ORS.
printf fmt, expr-list Format and print. See The printf Statement, below. printf fmt, expr-list Format and print. See The printf Statement, below.
printf fmt, expr-list >file printf fmt, expr-list >file
Format and print on file. Format and print on file.
system(cmd-line) Execute the command cmd-line, and return the exit s tatus. (This may not be avail- system(cmd-line) Execute the command cmd-line, and return the exit s tatus. (This may not be avail-
able on non-POSIX systems.) See GAWK: Effecti ve AWK Programming for the full able on non-POSIX systems.) See GAWK: Effective A WK Programming for the full
details on the exit status. details on the exit status.
fflush([file]) Flush any buffers associated with the open output f ile or pipe file. If file is fflush([file]) Flush any buffers associated with the open output file or pipe file. If file is
missing or if it is the null string, then flush all open output files and pipes. missing or if it is the null string, then flush all open output files and pipes.
Additional output redirections are allowed for print and printf. Additional output redirections are allowed for print and printf.
print ... >> file print ... >> file
Append output to the file. Append output to the file.
print ... | command print ... | command
Write on a pipe. Write on a pipe.
print ... |& command print ... |& command
Send data to a coprocess or socket. (See also the subsection Spec ial File Names, below.) Send data to a coprocess or socket. (See also the subsection Spec ial File Names, below.)
The getline command returns 1 on success, zero on end of file, and - 1 on an error. If the errno(3) The getline command returns 1 on success, zero on end of file, and -1 on an error. If the errno(3)
value indicates that the I/O operation may be retried, and PROCINFO["inpu t", "RETRY"] is set, then -2 is value indicates that the I/O operation may be retried, and PROCINFO["inpu t", "RETRY"] is set, then -2 is
returned instead of -1, and further calls to getline may be attempted. U pon an error, ERRNO is set to a returned instead of -1, and further calls to getline may be attempted. U pon an error, ERRNO is set to a
string describing the problem. string describing the problem.
NOTE: Failure in opening a two-way socket results in a non-fatal error be NOTE: Failure in opening a two-way socket results in a non-fatal erro
ing returned to the calling r being returned to the calling
function. If using a pipe, coprocess, or socket to getline, or from pri function. If using a pipe, coprocess, or socket to getline, or from print
nt or printf within a loop, you or printf within a loop, you
must use close() to create new instances of the command or socket. AWK must use close() to create new instances of the command or socket. A
does not automatically close WK does not automatically close
pipes, sockets, or coprocesses when they return EOF. pipes, sockets, or coprocesses when they return EOF.
The printf Statement The printf Statement
The AWK versions of the printf statement and sprintf() function (see belo w) accept the following conver- The AWK versions of the printf statement and sprintf() function (see belo w) accept the following conver-
sion specification formats: sion specification formats:
%a, %A A floating point number of the form [-]0xh.hhhhp+-dd (C99 hexadec imal floating point format). %a, %A A floating point number of the form [-]0xh.hhhhp+-dd (C99 hexa decimal floating point format).
For %A, uppercase letters are used instead of lowercase ones. For %A, uppercase letters are used instead of lowercase ones.
%c A single character. If the argument used for %c is numeric, i %c A single character. If the argument used for %c is numeric, it i
t is treated as a character and s treated as a character and
printed. Otherwise, the argument is assumed to be a string, and printed. Otherwise, the argument is assumed to be a string,
the only first character of and the only first character of
that string is printed. that string is printed.
%d, %i A decimal number (the integer part). %d, %i A decimal number (the integer part).
%e, %E A floating point number of the form [-]d.dddddde[+-]dd. The %E f ormat uses E instead of e. %e, %E A floating point number of the form [-]d.dddddde[+-]dd. The %E f ormat uses E instead of e.
%f, %F A floating point number of the form [-]ddd.dddddd. If the sy %f, %F A floating point number of the form [-]ddd.dddddd. If the system
stem library supports it, %F is library supports it, %F is
available as well. This is like %f, but uses capital letters for available as well. This is like %f, but uses capital letters
special “not a number” and for special “not a number” and
“infinity” values. If %F is not available, gawk uses %f. “infinity” values. If %F is not available, gawk uses %f.
%g, %G Use %e or %f conversion, whichever is shorter, with nonsignif icant zeros suppressed. The %G %g, %G Use %e or %f conversion, whichever is shorter, with nonsignifican t zeros suppressed. The %G
format uses %E instead of %e. format uses %E instead of %e.
%o An unsigned octal number (also an integer). %o An unsigned octal number (also an integer).
%u An unsigned decimal number (again, an integer). %u An unsigned decimal number (again, an integer).
%s A character string. %s A character string.
%x, %X An unsigned hexadecimal number (an integer). The %X format uses ABCDEF instead of abcdef. %x, %X An unsigned hexadecimal number (an integer). The %X format uses ABCDEF instead of abcdef.
%% A single % character; no argument is converted. %% A single % character; no argument is converted.
Optional, additional parameters may lie between the % and the control let ter: Optional, additional parameters may lie between the % and the control let ter:
count$ Use the count'th argument at this point in the formatting. This i s called a positional specifier count$ Use the count'th argument at this point in the formatting. This i s called a positional specifier
and is intended primarily for use in translated versions of form at strings, not in the original and is intended primarily for use in translated versions of format strings, not in the original
text of an AWK program. It is a gawk extension. text of an AWK program. It is a gawk extension.
- The expression should be left-justified within its field. - The expression should be left-justified within its field.
space For numeric conversions, prefix positive values with a space, and negative values with a minus space For numeric conversions, prefix positive values with a space, a nd negative values with a minus
sign. sign.
+ The plus sign, used before the width modifier (see below), s + The plus sign, used before the width modifier (see below), says t
ays to always supply a sign for o always supply a sign for
numeric conversions, even if the data to be formatted is positive. numeric conversions, even if the data to be formatted is posit
The + overrides the space ive. The + overrides the space
modifier. modifier.
# Use an “alternate form” for certain control letters. For %o, supp ly a leading zero. For %x, and # Use an “alternate form” for certain control letters. For %o, supp ly a leading zero. For %x, and
%X, supply a leading 0x or 0X for a nonzero result. For %e, %E, % f and %F, the result always %X, supply a leading 0x or 0X for a nonzero result. For %e, % E, %f and %F, the result always
contains a decimal point. For %g, and %G, trailing zeros are not removed from the result. contains a decimal point. For %g, and %G, trailing zeros are not removed from the result.
0 A leading 0 (zero) acts as a flag, indicating that output should b e padded with zeroes instead of 0 A leading 0 (zero) acts as a flag, indicating that output should b e padded with zeroes instead of
spaces. This applies only to the numeric output formats. This fl ag only has an effect when the spaces. This applies only to the numeric output formats. This f lag only has an effect when the
field width is wider than the value to be printed. field width is wider than the value to be printed.
' A single quote character instructs gawk to insert the locale's tho usands-separator character into ' A single quote character instructs gawk to insert the locale's tho usands-separator character into
decimal numbers, and to also use the locale's decimal point charac ter with floating point for- decimal numbers, and to also use the locale's decimal point cha racter with floating point for-
mats. This requires correct locale support in the C library and i n the definition of the current mats. This requires correct locale support in the C library and i n the definition of the current
locale. locale.
width The field should be padded to this width. The field is normally p added with spaces. With the 0 width The field should be padded to this width. The field is normally padded with spaces. With the 0
flag, it is padded with zeroes. flag, it is padded with zeroes.
.prec A number that specifies the precision to use when printing. For .prec A number that specifies the precision to use when printing. For t
the %e, %E, %f and %F, formats, he %e, %E, %f and %F, formats,
this specifies the number of digits you want printed to the right this specifies the number of digits you want printed to the right
of the decimal point. For the of the decimal point. For the
%g, and %G formats, it specifies the maximum number of significa %g, and %G formats, it specifies the maximum number of significant
nt digits. For the %d, %i, %o, digits. For the %d, %i, %o,
%u, %x, and %X formats, it specifies the minimum number of digits %u, %x, and %X formats, it specifies the minimum number of digit
to print. For the %s format, s to print. For the %s format,
it specifies the maximum number of characters from the string that should be printed. it specifies the maximum number of characters from the string that should be printed.
The dynamic width and prec capabilities of the ISO C printf() routines are supported. A * in place of The dynamic width and prec capabilities of the ISO C printf() routines ar e supported. A * in place of
either the width or prec specifications causes their values to be taken f rom the argument list to printf either the width or prec specifications causes their values to be taken f rom the argument list to printf
or sprintf(). To use a positional specifier with a dynamic width or pre cision, supply the count$ after or sprintf(). To use a positional specifier with a dynamic width or prec ision, supply the count$ after
the * in the format string. For example, "%3$*2$.*1$s". the * in the format string. For example, "%3$*2$.*1$s".
Special File Names Special File Names
When doing I/O redirection from either print or printf into a file, or vi When doing I/O redirection from either print or printf into a file, o
a getline from a file, gawk r via getline from a file, gawk
recognizes certain special filenames internally. These filenames allow recognizes certain special filenames internally. These filenames allow a
access to open file descriptors ccess to open file descriptors
inherited from gawk's parent process (usually the shell). These file nam es may also be used on the com- inherited from gawk's parent process (usually the shell). These file nam es may also be used on the com-
mand line to name data files. The filenames are: mand line to name data files. The filenames are:
- The standard input. - The standard input.
/dev/stdin The standard input. /dev/stdin The standard input.
/dev/stdout The standard output. /dev/stdout The standard output.
/dev/stderr The standard error output. /dev/stderr The standard error output.
skipping to change at line 1187 skipping to change at line 1186
/dev/fd/n The file associated with the open file descriptor n. /dev/fd/n The file associated with the open file descriptor n.
These are particularly useful for error messages. For example: These are particularly useful for error messages. For example:
print "You blew it!" > "/dev/stderr" print "You blew it!" > "/dev/stderr"
whereas you would otherwise have to use whereas you would otherwise have to use
print "You blew it!" | "cat 1>&2" print "You blew it!" | "cat 1>&2"
The following special filenames may be used with the |& coprocess opera tor for creating TCP/IP network The following special filenames may be used with the |& coprocess operato r for creating TCP/IP network
connections: connections:
/inet/tcp/lport/rhost/rport /inet/tcp/lport/rhost/rport
/inet4/tcp/lport/rhost/rport /inet4/tcp/lport/rhost/rport
/inet6/tcp/lport/rhost/rport /inet6/tcp/lport/rhost/rport
Files for a TCP/IP connection on local port lport to remote host r host on remote port rport. Use Files for a TCP/IP connection on local port lport to remote host r host on remote port rport. Use
a port of 0 to have the system pick a port. Use /inet4 to force a port of 0 to have the system pick a port. Use /inet4 to force a
an IPv4 connection, and /inet6 n IPv4 connection, and /inet6
to force an IPv6 connection. Plain /inet uses the system default to force an IPv6 connection. Plain /inet uses the system defa
(most likely IPv4). Usable ult (most likely IPv4). Usable
only with the |& two-way I/O operator. only with the |& two-way I/O operator.
/inet/udp/lport/rhost/rport /inet/udp/lport/rhost/rport
/inet4/udp/lport/rhost/rport /inet4/udp/lport/rhost/rport
/inet6/udp/lport/rhost/rport /inet6/udp/lport/rhost/rport
Similar, but use UDP/IP instead of TCP/IP. Similar, but use UDP/IP instead of TCP/IP.
Numeric Functions Numeric Functions
AWK has the following built-in arithmetic functions: AWK has the following built-in arithmetic functions:
skipping to change at line 1228 skipping to change at line 1227
sin(expr) Return the sine of expr, which is in radians. sin(expr) Return the sine of expr, which is in radians.
sqrt(expr) Return the square root of expr. sqrt(expr) Return the square root of expr.
srand([expr]) Use expr as the new seed for the random number generator. If no expr is provided, use the srand([expr]) Use expr as the new seed for the random number generator. If no expr is provided, use the
time of day. Return the previous seed for the random numbe r generator. time of day. Return the previous seed for the random numbe r generator.
String Functions String Functions
Gawk has the following built-in string functions: Gawk has the following built-in string functions:
asort(s [, d [, how] ]) Return the number of elements in the source array asort(s [, d [, how] ]) Return the number of elements in the source a
s. Sort the contents of s rray s. Sort the contents of s
using gawk's normal rules for comparing values, using gawk's normal rules for comparing values, a
and replace the indices of the nd replace the indices of the
sorted values s with sequential integers starting with 1. If the optional desti- sorted values s with sequential integers starting with 1. If the optional desti-
nation array d is specified, first duplicate s i nation array d is specified, first duplicate s in
nto d, and then sort d, leaving to d, and then sort d, leaving
the indices of the source array s unchanged. The the indices of the source array s unchanged. T
optional string how controls he optional string how controls
the direction and the comparison mode. Vali the direction and the comparison mode. Valid val
d values for how are any of the ues for how are any of the
strings valid for PROCINFO["sorted_in"]. It can strings valid for PROCINFO["sorted_in"]. It
also be the name of a user- can also be the name of a user-
defined comparison function as described in PROCI NFO["sorted_in"]. defined comparison function as described in PROCI NFO["sorted_in"].
asorti(s [, d [, how] ]) asorti(s [, d [, how] ])
Return the number of elements in the source arr Return the number of elements in the source array
ay s. The behavior is the same s. The behavior is the same
as that of asort(), except that the array indices as that of asort(), except that the array indice
are used for sorting, not the s are used for sorting, not the
array values. When done, the array is indexed array values. When done, the array is indexed nu
numerically, and the values are merically, and the values are
those of the original indices. The original valu those of the original indices. The original
es are lost; thus provide a values are lost; thus provide a
second array if you wish to preserve the origina second array if you wish to preserve the original
l. The purpose of the optional . The purpose of the optional
string how is the same as described previously fo r asort(). string how is the same as described previously fo r asort().
gensub(r, s, h [, t]) Search the target string t for matches of the reg gensub(r, s, h [, t]) Search the target string t for matches of the r
ular expression r. If h is a egular expression r. If h is a
string beginning with g or G, then replace all m string beginning with g or G, then replace all ma
atches of r with s. Otherwise, tches of r with s. Otherwise,
h is a number indicating which match of r to repl ace. If t is not supplied, use h is a number indicating which match of r to repl ace. If t is not supplied, use
$0 instead. Within the replacement text s, the $0 instead. Within the replacement text s, the s
sequence \n, where n is a digit equence \n, where n is a digit
from 1 to 9, may be used to indicate just the tex from 1 to 9, may be used to indicate just the te
t that matched the n'th paren- xt that matched the n'th paren-
thesized subexpression. The sequence \0 represe thesized subexpression. The sequence \0 represen
nts the entire matched text, as ts the entire matched text, as
does the character &. Unlike sub() and gsub(), t does the character &. Unlike sub() and gsub(),
he modified string is returned the modified string is returned
as the result of the function, and the original t arget string is not changed. as the result of the function, and the original t arget string is not changed.
gsub(r, s [, t]) For each substring matching the regular expressio n r in the string t, substitute gsub(r, s [, t]) For each substring matching the regular expressio n r in the string t, substitute
the string s, and return the number of substituti ons. If t is not supplied, use the string s, and return the number of substituti ons. If t is not supplied, use
$0. An & in the replacement text is replaced $0. An & in the replacement text is replaced wit
with the text that was actually h the text that was actually
matched. Use \& to get a literal &. (This must matched. Use \& to get a literal &. (This mu
be typed as "\\&"; see GAWK: st be typed as "\\&"; see GAWK:
Effective AWK Programming for a fuller discuss Effective AWK Programming for a fuller discussion
ion of the rules for ampersands of the rules for ampersands
and backslashes in the replacement text of sub(), gsub(), and gensub().) and backslashes in the replacement text of sub(), gsub(), and gensub().)
index(s, t) Return the index of the string t in the string s, index(s, t) Return the index of the string t in the string
or zero if t is not present. s, or zero if t is not present.
(This implies that character indices start at on (This implies that character indices start at one
e.) It is a fatal error to use .) It is a fatal error to use
a regexp constant for t. a regexp constant for t.
length([s]) Return the length of the string s, or the length of $0 if s is not supplied. As length([s]) Return the length of the string s, or the length of $0 if s is not supplied. As
a non-standard extension, with an array argument, length() returns the number of a non-standard extension, with an array argument, length() returns the number of
elements in the array. elements in the array.
match(s, r [, a]) Return the position in s where the regular expres match(s, r [, a]) Return the position in s where the regular expre
sion r occurs, or zero if r is ssion r occurs, or zero if r is
not present, and set the values of RSTART and R not present, and set the values of RSTART and RLE
LENGTH. Note that the argument NGTH. Note that the argument
order is the same as for the ~ operator: str ~ re . If array a is provided, a is order is the same as for the ~ operator: str ~ re . If array a is provided, a is
cleared and then elements 1 through n are fil cleared and then elements 1 through n are filled
led with the portions of s that with the portions of s that
match the corresponding parenthesized subexpressi match the corresponding parenthesized subexpres
on in r. The zero'th element sion in r. The zero'th element
of a contains the portion of s matched by the ent ire regular expression r. Sub- of a contains the portion of s matched by the ent ire regular expression r. Sub-
scripts a[n, "start"], and a[n, "length"] provide the starting index in the scripts a[n, "start"], and a[n, "length"] pr ovide the starting index in the
string and length respectively, of each matching substring. string and length respectively, of each matching substring.
patsplit(s, a [, r [, seps] ]) patsplit(s, a [, r [, seps] ])
Split the string s into the array a and the separ ators array seps on the regular Split the string s into the array a and the separ ators array seps on the regular
expression r, and return the number of fields. E expression r, and return the number of fields.
lement values are the portions Element values are the portions
of s that matched r. The value of seps[i] is t of s that matched r. The value of seps[i] is the
he possibly null separator that possibly null separator that
appeared after a[i]. The value of seps[0] is the appeared after a[i]. The value of seps[0] is th
possibly null leading separa- e possibly null leading separa-
tor. If r is omitted, FPAT is used instead. Th tor. If r is omitted, FPAT is used instead. The
e arrays a and seps are cleared arrays a and seps are cleared
first. Splitting behaves identically to field sp first. Splitting behaves identically to field
litting with FPAT, described splitting with FPAT, described
above. above.
split(s, a [, r [, seps] ]) split(s, a [, r [, seps] ])
Split the string s into the array a and the separ ators array seps on the regular Split the string s into the array a and the separ ators array seps on the regular
expression r, and return the number of fields. I f r is omitted, FS is used expression r, and return the number of field s. If r is omitted, FS is used
instead. The arrays a and seps are cleared first . seps[i] is the field separa- instead. The arrays a and seps are cleared first . seps[i] is the field separa-
tor matched by r between a[i] and a[i+1]. If r i tor matched by r between a[i] and a[i+1]. If r
s a single space, then leading is a single space, then leading
whitespace in s goes into the extra array elem whitespace in s goes into the extra array element
ent seps[0] and trailing white- seps[0] and trailing white-
space goes into the extra array element seps[n], space goes into the extra array element seps[n],
where n is the return value of where n is the return value of
split(s, a, r, seps). Splitting behaves id split(s, a, r, seps). Splitting behaves ide
entically to field splitting, ntically to field splitting,
described above. In particular, if r is a single described above. In particular, if r is a singl
-character string, that string e-character string, that string
acts as the separator, even if it happens to be a regular expression metacharac- acts as the separator, even if it happens to be a regular expression metacharac-
ter. ter.
sprintf(fmt, expr-list) Print expr-list according to fmt, and return the resulting string. sprintf(fmt, expr-list) Print expr-list according to fmt, and return the resulting string.
strtonum(str) Examine str, and return its numeric value. If st r begins with a leading 0, strtonum(str) Examine str, and return its numeric value. If str begins with a leading 0,
treat it as an octal number. If str begins with a leading 0x or 0X, treat it as treat it as an octal number. If str begins with a leading 0x or 0X, treat it as
a hexadecimal number. Otherwise, assume it is a decimal number. a hexadecimal number. Otherwise, assume it is a decimal number.
sub(r, s [, t]) Just like gsub(), but replace only the first matc hing substring. Return either sub(r, s [, t]) Just like gsub(), but replace only the first mat ching substring. Return either
zero or one. zero or one.
substr(s, i [, n]) Return the at most n-character substring of s s tarting at i. If n is omitted, substr(s, i [, n]) Return the at most n-character substring of s sta rting at i. If n is omitted,
use the rest of s. use the rest of s.
tolower(str) Return a copy of the string str, with all the upp ercase characters in str trans- tolower(str) Return a copy of the string str, with all the upp ercase characters in str trans-
lated to their corresponding lowercase counterpa rts. Non-alphabetic characters lated to their corresponding lowercase counterpar ts. Non-alphabetic characters
are left unchanged. are left unchanged.
toupper(str) Return a copy of the string str, with all the low ercase characters in str trans- toupper(str) Return a copy of the string str, with all the low ercase characters in str trans-
lated to their corresponding uppercase counterpa rts. Non-alphabetic characters lated to their corresponding uppercase counterpar ts. Non-alphabetic characters
are left unchanged. are left unchanged.
Gawk is multibyte aware. This means that index(), length(), substr() and match() all work in terms of Gawk is multibyte aware. This means that index(), length(), substr() a nd match() all work in terms of
characters, not bytes. characters, not bytes.
Time Functions Time Functions
Since one of the primary uses of AWK programs is processing log files t hat contain time stamp informa- Since one of the primary uses of AWK programs is processing log files tha t contain time stamp informa-
tion, gawk provides the following functions for obtaining time stamps and formatting them. tion, gawk provides the following functions for obtaining time stamps and formatting them.
mktime(datespec [, utc-flag]) mktime(datespec [, utc-flag])
Turn datespec into a time stamp of the same form as returned b Turn datespec into a time stamp of the same form as return
y systime(), and return the ed by systime(), and return the
result. The datespec is a string of the form YYYY MM DD HH MM result. The datespec is a string of the form YYYY MM DD HH MM
SS[ DST]. The contents of the SS[ DST]. The contents of the
string are six or seven numbers representing respectively the f ull year including century, the string are six or seven numbers representing respectively the f ull year including century, the
month from 1 to 12, the day of the month from 1 to 31, the ho month from 1 to 12, the day of the month from 1 to 31, the hour
ur of the day from 0 to 23, the of the day from 0 to 23, the
minute from 0 to 59, the second from 0 to 60, and an optional d minute from 0 to 59, the second from 0 to 60, and an optional
aylight saving flag. The val- daylight saving flag. The val-
ues of these numbers need not be within the ranges specified; f or example, an hour of -1 means ues of these numbers need not be within the ranges specified; f or example, an hour of -1 means
1 hour before midnight. The origin-zero Gregorian calendar is 1 hour before midnight. The origin-zero Gregorian calendar is
assumed, with year 0 preceding assumed, with year 0 preceding
year 1 and year -1 preceding year 0. If utc-flag is present a year 1 and year -1 preceding year 0. If utc-flag is present an
nd is non-zero or non-null, the d is non-zero or non-null, the
time is assumed to be in the UTC time zone; otherwise, the time time is assumed to be in the UTC time zone; otherwise, the tim
is assumed to be in the local e is assumed to be in the local
time zone. If the DST daylight saving flag is positive, the time zone. If the DST daylight saving flag is positive, the ti
time is assumed to be daylight me is assumed to be daylight
saving time; if zero, the time is assumed to be standard time; saving time; if zero, the time is assumed to be standard time;
and if negative (the default), and if negative (the default),
mktime() attempts to determine whether daylight saving time mktime() attempts to determine whether daylight saving time is
is in effect for the specified in effect for the specified
time. If datespec does not contain enough elements or if the r time. If datespec does not contain enough elements or if the
esulting time is out of range, resulting time is out of range,
mktime() returns -1. mktime() returns -1.
strftime([format [, timestamp[, utc-flag]]]) strftime([format [, timestamp[, utc-flag]]])
Format timestamp according to the specification in format. If utc-flag is present and is non- Format timestamp according to the specification in format. If utc-flag is present and is non-
zero or non-null, the result is in UTC, otherwise the result is zero or non-null, the result is in UTC, otherwise the result i
in local time. The timestamp s in local time. The timestamp
should be of the same form as returned by systime(). If ti should be of the same form as returned by systime(). If timest
mestamp is missing, the current amp is missing, the current
time of day is used. If format is missing, a default format time of day is used. If format is missing, a default for
equivalent to the output of mat equivalent to the output of
date(1) is used. The default format is available in PROCINFO[" strftime"]. See the specifica- date(1) is used. The default format is available in PROCINFO[" strftime"]. See the specifica-
tion for the strftime() function in ISO C for the format conver sions that are guaranteed to be tion for the strftime() function in ISO C for the format conver sions that are guaranteed to be
available. available.
systime() Return the current time of day as the number of seconds since the Epoch (1970-01-01 00:00:00 systime() Return the current time of day as the number of seconds since t he Epoch (1970-01-01 00:00:00
UTC on POSIX systems). UTC on POSIX systems).
Bit Manipulations Functions Bit Manipulations Functions
Gawk supplies the following bit manipulation functions. They work by con verting double-precision float- Gawk supplies the following bit manipulation functions. They work by con verting double-precision float-
ing point values to uintmax_t integers, doing the operation, and the n converting the result back to ing point values to uintmax_t integers, doing the operation, and then co nverting the result back to
floating point. floating point.
NOTE: Passing negative operands to any of these functions causes a fatal error. NOTE: Passing negative operands to any of these functions causes a fatal error.
The functions are: The functions are:
and(v1, v2 [, ...]) Return the bitwise AND of the values provided in the argument list. There must be and(v1, v2 [, ...]) Return the bitwise AND of the values provided in th e argument list. There must be
at least two. at least two.
compl(val) Return the bitwise complement of val. compl(val) Return the bitwise complement of val.
lshift(val, count) Return the value of val, shifted left by count bits. lshift(val, count) Return the value of val, shifted left by count bits.
or(v1, v2 [, ...]) Return the bitwise OR of the values provided in the a rgument list. There must be at or(v1, v2 [, ...]) Return the bitwise OR of the values provided in the a rgument list. There must be at
least two. least two.
rshift(val, count) Return the value of val, shifted right by count bits. rshift(val, count) Return the value of val, shifted right by count bits.
xor(v1, v2 [, ...]) Return the bitwise XOR of the values provided in the argument list. There must be xor(v1, v2 [, ...]) Return the bitwise XOR of the values provided in th e argument list. There must be
at least two. at least two.
Type Functions Type Functions
The following functions provide type related information about their argu ments. The following functions provide type related information about their argu ments.
isarray(x) Return true if x is an array, false otherwise. This function is mainly for use with the ele- isarray(x) Return true if x is an array, false otherwise. This function is mainly for use with the ele-
ments of multidimensional arrays and with function parameters. ments of multidimensional arrays and with function parameters.
typeof(x) Return a string indicating the type of x. The string will be one of "array", "number", "reg- typeof(x) Return a string indicating the type of x. The string will be one of "array", "number", "reg-
exp", "string", "strnum", "unassigned", or "undefined". exp", "string", "strnum", "unassigned", or "undefined".
Internationalization Functions Internationalization Functions
The following functions may be used from within your AWK program for t ranslating strings at run-time. The following functions may be used from within your AWK program for tran slating strings at run-time.
For full details, see GAWK: Effective AWK Programming. For full details, see GAWK: Effective AWK Programming.
bindtextdomain(directory [, domain]) bindtextdomain(directory [, domain])
Specify the directory where gawk looks for the .gmo files, in case Specify the directory where gawk looks for the .gmo files, in
they will not or cannot be case they will not or cannot be
placed in the ``standard'' locations (e.g., during testing). placed in the ``standard'' locations (e.g., during testing). It
It returns the directory where returns the directory where
domain is ``bound.'' domain is ``bound.''
The default domain is the value of TEXTDOMAIN. If directory is th e null string (""), then bind- The default domain is the value of TEXTDOMAIN. If directory is t he null string (""), then bind-
textdomain() returns the current binding for the given domain. textdomain() returns the current binding for the given domain.
dcgettext(string [, domain [, category]]) dcgettext(string [, domain [, category]])
Return the translation of string in text domain domain for locale category category. The default Return the translation of string in text domain domain for locale category category. The default
value for domain is the current value of TEXTDOMAIN. The default value for category is "LC_MES- value for domain is the current value of TEXTDOMAIN. The default value for category is "LC_MES-
SAGES". SAGES".
If you supply a value for category, it must be a string equal t If you supply a value for category, it must be a string equal to o
o one of the known locale cate- ne of the known locale cate-
gories described in GAWK: Effective AWK Programming. You must als gories described in GAWK: Effective AWK Programming. You must
o supply a text domain. Use also supply a text domain. Use
TEXTDOMAIN if you want to use the current domain. TEXTDOMAIN if you want to use the current domain.
dcngettext(string1, string2, number [, domain [, category]]) dcngettext(string1, string2, number [, domain [, category]])
Return the plural form used for number of the translation of str Return the plural form used for number of the translation of strin
ing1 and string2 in text domain g1 and string2 in text domain
domain for locale category category. The default value for doma domain for locale category category. The default value for
in is the current value of domain is the current value of
TEXTDOMAIN. The default value for category is "LC_MESSAGES". TEXTDOMAIN. The default value for category is "LC_MESSAGES".
If you supply a value for category, it must be a string equal t If you supply a value for category, it must be a string equal to o
o one of the known locale cate- ne of the known locale cate-
gories described in GAWK: Effective AWK Programming. You must als gories described in GAWK: Effective AWK Programming. You must
o supply a text domain. Use also supply a text domain. Use
TEXTDOMAIN if you want to use the current domain. TEXTDOMAIN if you want to use the current domain.
USER-DEFINED FUNCTIONS USER-DEFINED FUNCTIONS
Functions in AWK are defined as follows: Functions in AWK are defined as follows:
function name(parameter list) { statements } function name(parameter list) { statements }
Functions execute when they are called from within expressions in eith Functions execute when they are called from within expressions in either
er patterns or actions. Actual patterns or actions. Actual
parameters supplied in the function call are used to instantiate the form parameters supplied in the function call are used to instantiate the fo
al parameters declared in the rmal parameters declared in the
function. Arrays are passed by reference, other variables are passed by value. function. Arrays are passed by reference, other variables are passed by value.
Since functions were not originally part of the AWK language, the p Since functions were not originally part of the AWK language, the provi
rovision for local variables is sion for local variables is
rather clumsy: They are declared as extra parameters in the parameter lis rather clumsy: They are declared as extra parameters in the parameter li
t. The convention is to sepa- st. The convention is to sepa-
rate local variables from real parameters by extra spaces in the paramete r list. For example: rate local variables from real parameters by extra spaces in the paramete r list. For example:
function f(p, q, a, b) # a and b are local function f(p, q, a, b) # a and b are local
{ {
... ...
} }
/abc/ { ... ; f(1, 2) ; ... } /abc/ { ... ; f(1, 2) ; ... }
The left parenthesis in a function call is required to immediately follow the function name, without any The left parenthesis in a function call is required to immediately follow the function name, without any
intervening whitespace. This avoids a syntactic ambiguity with the concatenation operator. This intervening whitespace. This avoids a syntactic ambiguity with th e concatenation operator. This
restriction does not apply to the built-in functions listed above. restriction does not apply to the built-in functions listed above.
Functions may call each other and may be recursive. Function paramet ers used as local variables are Functions may call each other and may be recursive. Function parameters used as local variables are
initialized to the null string and the number zero upon function invocati on. initialized to the null string and the number zero upon function invocati on.
Use return expr to return a value from a function. The return value is u ndefined if no value is pro- Use return expr to return a value from a function. The return value i s undefined if no value is pro-
vided, or if the function returns by “falling off” the end. vided, or if the function returns by “falling off” the end.
As a gawk extension, functions may be called indirectly. To do this, ass ign the name of the function to As a gawk extension, functions may be called indirectly. To do this, assi gn the name of the function to
be called, as a string, to a variable. Then use the variable as if it we re the name of a function, pre- be called, as a string, to a variable. Then use the variable as if it we re the name of a function, pre-
fixed with an @ sign, like so: fixed with an @ sign, like so:
function myfunc() function myfunc()
{ {
print "myfunc called" print "myfunc called"
... ...
} }
{ ... { ...
the_func = "myfunc" the_func = "myfunc"
@the_func() # call through the_func to myfunc @the_func() # call through the_func to myfunc
... ...
} }
As of version 4.1.2, this works with user-defined functions, built-in functions, and extension func- As of version 4.1.2, this works with user-defined functions, built-in fu nctions, and extension func-
tions. tions.
If --lint has been provided, gawk warns about calls to undefined function s at parse time, instead of at If --lint has been provided, gawk warns about calls to undefined functio ns at parse time, instead of at
run time. Calling an undefined function at run time is a fatal error. run time. Calling an undefined function at run time is a fatal error.
The word func may be used in place of function, although this is deprecat ed. The word func may be used in place of function, although this is deprecat ed.
DYNAMICALLY LOADING NEW FUNCTIONS DYNAMICALLY LOADING NEW FUNCTIONS
You can dynamically add new functions written in C or C++ to the running gawk interpreter with the @load You can dynamically add new functions written in C or C++ to the running gawk interpreter with the @load
statement. The full details are beyond the scope of this manual page; se e GAWK: Effective AWK Program- statement. The full details are beyond the scope of this manual page; s ee GAWK: Effective AWK Program-
ming. ming.
SIGNALS SIGNALS
The gawk profiler accepts two signals. SIGUSR1 causes it to dump a pro file and function call stack to The gawk profiler accepts two signals. SIGUSR1 causes it to dump a profi le and function call stack to
the profile file, which is either awkprof.out, or whatever file was named with the --profile option. It the profile file, which is either awkprof.out, or whatever file was named with the --profile option. It
then continues to run. SIGHUP causes gawk to dump the profile and functi on call stack and then exit. then continues to run. SIGHUP causes gawk to dump the profile and functi on call stack and then exit.
INTERNATIONALIZATION INTERNATIONALIZATION
String constants are sequences of characters enclosed in double quotes. String constants are sequences of characters enclosed in double quotes.
In non-English speaking envi- In non-English speaking envi-
ronments, it is possible to mark strings in the AWK program as requiring ronments, it is possible to mark strings in the AWK program as requiring
translation to the local natu- translation to the local natu-
ral language. Such strings are marked in the AWK program with a leading u nderscore (“_”). For example, ral language. Such strings are marked in the AWK program with a leading u nderscore (“_”). For example,
gawk 'BEGIN { print "hello, world" }' gawk 'BEGIN { print "hello, world" }'
always prints hello, world. But, always prints hello, world. But,
gawk 'BEGIN { print _"hello, world" }' gawk 'BEGIN { print _"hello, world" }'
might print bonjour, monde in France. might print bonjour, monde in France.
There are several steps involved in producing and running a localizable A WK program. There are several steps involved in producing and running a localizable A WK program.
1. Add a BEGIN action to assign a value to the TEXTDOMAIN variable t o set the text domain to a name 1. Add a BEGIN action to assign a value to the TEXTDOMAIN variable to se t the text domain to a name
associated with your program: associated with your program:
BEGIN { TEXTDOMAIN = "myprog" } BEGIN { TEXTDOMAIN = "myprog" }
This allows gawk to find the .gmo file associated with your program. Without this step, gawk uses This allows gawk to find the .gmo file associated with your program . Without this step, gawk uses
the messages text domain, which likely does not contain translations for your program. the messages text domain, which likely does not contain translations for your program.
2. Mark all strings that should be translated with leading underscores. 2. Mark all strings that should be translated with leading underscores.
3. If necessary, use the dcgettext() and/or bindtextdomain() functions i n your program, as appropriate. 3. If necessary, use the dcgettext() and/or bindtextdomain() functions i n your program, as appropriate.
4. Run gawk --gen-pot -f myprog.awk > myprog.pot to generate a .pot file for your program. 4. Run gawk --gen-pot -f myprog.awk > myprog.pot to generate a .pot file for your program.
5. Provide appropriate translations, and build and install the correspon ding .gmo files. 5. Provide appropriate translations, and build and install the correspon ding .gmo files.
The internationalization features are described in full detail in GAWK: E ffective AWK Programming. The internationalization features are described in full detail in GAWK: E ffective AWK Programming.
POSIX COMPATIBILITY POSIX COMPATIBILITY
A primary goal for gawk is compatibility with the POSIX standard, as wel l as with the latest version of A primary goal for gawk is compatibility with the POSIX standard, as well as with the latest version of
Brian Kernighan's awk. To this end, gawk incorporates the following user visible features which are not Brian Kernighan's awk. To this end, gawk incorporates the following user visible features which are not
described in the AWK book, but are part of the Brian Kernighan's versi on of awk, and are in the POSIX described in the AWK book, but are part of the Brian Kernighan's version of awk, and are in the POSIX
standard. standard.
The book indicates that command line variable assignment happens when awk would otherwise open the argu- The book indicates that command line variable assignment happens when awk would otherwise open the argu-
ment as a file, which is after the BEGIN rule is executed. However, i n earlier implementations, when ment as a file, which is after the BEGIN rule is executed. However, in earlier implementations, when
such an assignment appeared before any file names, the assignment would h appen before the BEGIN rule was such an assignment appeared before any file names, the assignment would h appen before the BEGIN rule was
run. Applications came to depend on this “feature.” When awk was chan run. Applications came to depend on this “feature.” When awk was change
ged to match its documentation, d to match its documentation,
the -v option for assigning variables before program execution was added the -v option for assigning variables before program execution was ad
to accommodate applications ded to accommodate applications
that depended upon the old behavior. (This feature was agreed upon by bo th the Bell Laboratories devel- that depended upon the old behavior. (This feature was agreed upon by bo th the Bell Laboratories devel-
opers and the GNU developers.) opers and the GNU developers.)
When processing arguments, gawk uses the special option “--” to signal th e end of arguments. In compat- When processing arguments, gawk uses the special option “--” to signal th e end of arguments. In compat-
ibility mode, it warns about but otherwise ignores undefined options. In normal operation, such argu- ibility mode, it warns about but otherwise ignores undefined options. In normal operation, such argu-
ments are passed on to the AWK program for it to process. ments are passed on to the AWK program for it to process.
The AWK book does not define the return value of srand(). The POSIX stan The AWK book does not define the return value of srand(). The POSIX sta
dard has it return the seed it ndard has it return the seed it
was using, to allow keeping track of random number sequences. Therefo was using, to allow keeping track of random number sequences. Therefore
re srand() in gawk also returns srand() in gawk also returns
its current seed. its current seed.
Other features are: The use of multiple -f options (from MKS awk); the EN Other features are: The use of multiple -f options (from MKS awk); th
VIRON array; the \a, and \v e ENVIRON array; the \a, and \v
escape sequences (done originally in gawk and fed back into the escape sequences (done originally in gawk and fed back into the Bel
Bell Laboratories version); the l Laboratories version); the
tolower() and toupper() built-in functions (from the Bell Laboratories ve tolower() and toupper() built-in functions (from the Bell Laboratories
rsion); and the ISO C conver- version); and the ISO C conver-
sion specifications in printf (done first in the Bell Laboratories versio n). sion specifications in printf (done first in the Bell Laboratories versio n).
HISTORICAL FEATURES HISTORICAL FEATURES
There is one feature of historical AWK implementations that gawk suppo rts: It is possible to call the There is one feature of historical AWK implementations that gawk supports : It is possible to call the
length() built-in function not only with no argument, but even without pa rentheses! Thus, length() built-in function not only with no argument, but even without pa rentheses! Thus,
a = length # Holy Algol 60, Batman! a = length # Holy Algol 60, Batman!
is the same as either of is the same as either of
a = length() a = length()
a = length($0) a = length($0)
Using this feature is poor practice, and gawk issues a warning about its use if --lint is specified on Using this feature is poor practice, and gawk issues a warning about it s use if --lint is specified on
the command line. the command line.
GNU EXTENSIONS GNU EXTENSIONS
Gawk has a too-large number of extensions to POSIX awk. They are desc ribed in this section. All the Gawk has a too-large number of extensions to POSIX awk. They are describ ed in this section. All the
extensions described here can be disabled by invoking gawk with the --tra ditional or --posix options. extensions described here can be disabled by invoking gawk with the --tra ditional or --posix options.
The following features of gawk are not available in POSIX awk. The following features of gawk are not available in POSIX awk.
· No path search is performed for files named via the -f option. There fore the AWKPATH environment · No path search is performed for files named via the -f option. Th erefore the AWKPATH environment
variable is not special. variable is not special.
· There is no facility for doing file inclusion (gawk's @include mechanis m). · There is no facility for doing file inclusion (gawk's @include mechanis m).
· There is no facility for dynamically adding new functions written in C (gawk's @load mechanism). · There is no facility for dynamically adding new functions written in C (gawk's @load mechanism).
· The \x escape sequence. · The \x escape sequence.
· The ability to continue lines after ? and :. · The ability to continue lines after ? and :.
skipping to change at line 1587 skipping to change at line 1586
· The FUNCTAB, SYMTAB, and PROCINFO arrays are not available. · The FUNCTAB, SYMTAB, and PROCINFO arrays are not available.
· The use of RS as a regular expression. · The use of RS as a regular expression.
· The special file names available for I/O redirection are not recognized . · The special file names available for I/O redirection are not recognized .
· The |& operator for creating coprocesses. · The |& operator for creating coprocesses.
· The BEGINFILE and ENDFILE special patterns are not available. · The BEGINFILE and ENDFILE special patterns are not available.
· The ability to split out individual characters using the null string as the value of FS, and as the · The ability to split out individual characters using the null string as the value of FS, and as the
third argument to split(). third argument to split().
· An optional fourth argument to split() to receive the separator texts. · An optional fourth argument to split() to receive the separator texts.
· The optional second argument to the close() function. · The optional second argument to the close() function.
· The optional third argument to the match() function. · The optional third argument to the match() function.
· The ability to use positional specifiers with printf and sprintf(). · The ability to use positional specifiers with printf and sprintf().
· The ability to pass an array to length(). · The ability to pass an array to length().
· The and(), asort(), asorti(), bindtextdomain(), compl(), dcgettex t(), dcngettext(), gensub(), · The and(), asort(), asorti(), bindtextdomain(), compl(), dcgette xt(), dcngettext(), gensub(),
lshift(), mktime(), or(), patsplit(), rshift(), strftime(), strtonum(), systime() and xor() functions. lshift(), mktime(), or(), patsplit(), rshift(), strftime(), strtonum(), systime() and xor() functions.
· Localizable strings. · Localizable strings.
· Non-fatal I/O. · Non-fatal I/O.
· Retryable I/O. · Retryable I/O.
The AWK book does not define the return value of the close() function. G awk's close() returns the value The AWK book does not define the return value of the close() function. G awk's close() returns the value
from fclose(3), or pclose(3), when closing an output file or pipe, r from fclose(3), or pclose(3), when closing an output file or pipe
espectively. It returns the , respectively. It returns the
process's exit status when closing an input pipe. The return value i process's exit status when closing an input pipe. The return value is -1
s -1 if the named file, pipe or if the named file, pipe or
coprocess was not opened with a redirection. coprocess was not opened with a redirection.
When gawk is invoked with the --traditional option, if the fs argument to When gawk is invoked with the --traditional option, if the fs argument t
the -F option is “t”, then FS o the -F option is “t”, then FS
is set to the tab character. Note that typing gawk -F\t ... simply cau is set to the tab character. Note that typing gawk -F\t ... simply caus
ses the shell to quote the “t,” es the shell to quote the “t,”
and does not pass “\t” to the -F option. Since this is a rather ugly s and does not pass “\t” to the -F option. Since this is a rather u
pecial case, it is not the gly special case, it is not the
default behavior. This behavior also does not occur if --posix has been specified. To really get a tab default behavior. This behavior also does not occur if --posix has been specified. To really get a tab
character as the field separator, it is best to use single quotes: gawk - F'\t' .... character as the field separator, it is best to use single quotes: gawk - F'\t' ....
ENVIRONMENT VARIABLES ENVIRONMENT VARIABLES
The AWKPATH environment variable can be used to provide a list of directo The AWKPATH environment variable can be used to provide a list of dire
ries that gawk searches when ctories that gawk searches when
looking for files named via the -f, --file, -i and --include options, looking for files named via the -f, --file, -i and --include options, and
and the @include directive. If the @include directive. If
the initial search fails, the path is searched again after appending .awk to the filename. the initial search fails, the path is searched again after appending .awk to the filename.
The AWKLIBPATH environment variable can be used to provide a list of dire ctories that gawk searches when The AWKLIBPATH environment variable can be used to provide a list of dire ctories that gawk searches when
looking for files named via the -l and --load options. looking for files named via the -l and --load options.
The GAWK_READ_TIMEOUT environment variable can be used to specify a time out in milliseconds for reading The GAWK_READ_TIMEOUT environment variable can be used to specify a timeo ut in milliseconds for reading
input from a terminal, pipe or two-way communication including sockets. input from a terminal, pipe or two-way communication including sockets.
For connection to a remote host via socket, GAWK_SOCK_RETRIES controls For connection to a remote host via socket, GAWK_SOCK_RETRIES cont
the number of retries, and rols the number of retries, and
GAWK_MSEC_SLEEP the interval between retries. The interval is in milli GAWK_MSEC_SLEEP the interval between retries. The interval is in millise
seconds. On systems that do not conds. On systems that do not
support usleep(3), the value is rounded up to an integral number of secon ds. support usleep(3), the value is rounded up to an integral number of secon ds.
If POSIXLY_CORRECT exists in the environment, then gawk behaves exactly a s if --posix had been specified If POSIXLY_CORRECT exists in the environment, then gawk behaves exactly a s if --posix had been specified
on the command line. If --lint has been specified, gawk issues a warning message to this effect. on the command line. If --lint has been specified, gawk issues a warning message to this effect.
EXIT STATUS EXIT STATUS
If the exit statement is used with a value, then gawk exits with the nume ric value given to it. If the exit statement is used with a value, then gawk exits with the nume ric value given to it.
Otherwise, if there were no problems during execution, gawk exits w ith the value of the C constant Otherwise, if there were no problems during execution, gawk exits with t he value of the C constant
EXIT_SUCCESS. This is usually zero. EXIT_SUCCESS. This is usually zero.
If an error occurs, gawk exits with the value of the C constant EXIT_FAIL URE. This is usually one. If an error occurs, gawk exits with the value of the C constant EXIT_FAIL URE. This is usually one.
If gawk exits because of a fatal error, the exit status is 2. On non-POS IX systems, this value may be If gawk exits because of a fatal error, the exit status is 2. On non-P OSIX systems, this value may be
mapped to EXIT_FAILURE. mapped to EXIT_FAILURE.
VERSION INFORMATION VERSION INFORMATION
This man page documents gawk, version 5.0. This man page documents gawk, version 5.1.
AUTHORS AUTHORS
The original version of UNIX awk was designed and implemented by Alfred A ho, Peter Weinberger, and Brian The original version of UNIX awk was designed and implemented by Alfred A ho, Peter Weinberger, and Brian
Kernighan of Bell Laboratories. Brian Kernighan continues to maintain an d enhance it. Kernighan of Bell Laboratories. Brian Kernighan continues to maintain an d enhance it.
Paul Rubin and Jay Fenlason, of the Free Software Foundation, wrote gawk, Paul Rubin and Jay Fenlason, of the Free Software Foundation, wrote
to be compatible with the gawk, to be compatible with the
original version of awk distributed in Seventh Edition UNIX. John Wo original version of awk distributed in Seventh Edition UNIX. John Woods
ods contributed a number of bug contributed a number of bug
fixes. David Trueman, with contributions from Arnold Robbins, made gawk compatible with the new version fixes. David Trueman, with contributions from Arnold Robbins, made gawk compatible with the new version
of UNIX awk. Arnold Robbins is the current maintainer. of UNIX awk. Arnold Robbins is the current maintainer.
See GAWK: Effective AWK Programming for a full list of the contributors t o gawk and its documentation. See GAWK: Effective AWK Programming for a full list of the contributors t o gawk and its documentation.
See the README file in the gawk distribution for up-to-date informat ion about maintainers and which See the README file in the gawk distribution for up-to-date information about maintainers and which
ports are currently supported. ports are currently supported.
BUG REPORTS BUG REPORTS
If you find a bug in gawk, please send electronic mail to bug-gawk@gnu.or g. Please include your operat- If you find a bug in gawk, please send electronic mail to bug-gawk@gnu.or g. Please include your operat-
ing system and its revision, the version of gawk (from gawk --version ), which C compiler you used to ing system and its revision, the version of gawk (from gawk --version), w hich C compiler you used to
compile it, and a test program and data that are as small as possible for reproducing the problem. compile it, and a test program and data that are as small as possible for reproducing the problem.
Before sending a bug report, please do the following things. First, veri Before sending a bug report, please do the following things. First,
fy that you have the latest verify that you have the latest
version of gawk. Many bugs (usually subtle ones) are fixed at each version of gawk. Many bugs (usually subtle ones) are fixed at each relea
release, and if yours is out of se, and if yours is out of
date, the problem may already have been solved. Second, please see if se date, the problem may already have been solved. Second, please see if s
tting the environment variable etting the environment variable
LC_ALL to LC_ALL=C causes things to behave as you expect. If so, it's a l ocale issue, and may or may not LC_ALL to LC_ALL=C causes things to behave as you expect. If so, it's a l ocale issue, and may or may not
really be a bug. Finally, please read this man page and the reference ma nual carefully to be sure that really be a bug. Finally, please read this man page and the reference m anual carefully to be sure that
what you think is a bug really is, instead of just a quirk in the languag e. what you think is a bug really is, instead of just a quirk in the languag e.
Whatever you do, do NOT post a bug report in comp.lang.awk. While the ga wk developers occasionally read Whatever you do, do NOT post a bug report in comp.lang.awk. While the ga wk developers occasionally read
this newsgroup, posting bug reports there is an unreliable way to report this newsgroup, posting bug reports there is an unreliable way to report
bugs. Similarly, do NOT use a bugs. Similarly, do NOT use a
web forum (such as Stack Overflow) for reporting bugs. Instead, web forum (such as Stack Overflow) for reporting bugs. Instead, ple
please use the electronic mail ase use the electronic mail
addresses given above. Really. addresses given above. Really.
If you're using a GNU/Linux or BSD-based system, you may wish to submit a If you're using a GNU/Linux or BSD-based system, you may wish to submi
bug report to the vendor of t a bug report to the vendor of
your distribution. That's fine, but please send a copy to the offici your distribution. That's fine, but please send a copy to the official e
al email address as well, since mail address as well, since
there's no guarantee that the bug report will be forwarded to the gawk ma intainer. there's no guarantee that the bug report will be forwarded to the gawk ma intainer.
BUGS BUGS
The -F option is not necessary given the command line variable assignment feature; it remains only for The -F option is not necessary given the command line variable assignme nt feature; it remains only for
backwards compatibility. backwards compatibility.
SEE ALSO SEE ALSO
egrep(1), sed(1), getpid(2), getppid(2), getpgrp(2), getuid(2), geteuid( 2), getgid(2), getegid(2), get- egrep(1), sed(1), getpid(2), getppid(2), getpgrp(2), getuid(2), geteuid(2 ), getgid(2), getegid(2), get-
groups(2), printf(3), strftime(3), usleep(3) groups(2), printf(3), strftime(3), usleep(3)
The AWK Programming Language, Alfred V. Aho, Brian W. Kernighan, Peter J . Weinberger, Addison-Wesley, The AWK Programming Language, Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger, Addison-Wesley,
1988. ISBN 0-201-07981-X. 1988. ISBN 0-201-07981-X.
GAWK: Effective AWK Programming, Edition 5.0, shipped with the gawk sourc e. The current version of this GAWK: Effective AWK Programming, Edition 5.1, shipped with the gawk sourc e. The current version of this
document is available online at https://www.gnu.org/software/gawk/manual. document is available online at https://www.gnu.org/software/gawk/manual.
The GNU gettext documentation, available online at https://www.gnu.org/so ftware/gettext. The GNU gettext documentation, available online at https://www.gnu.org/so ftware/gettext.
EXAMPLES EXAMPLES
Print and sort the login names of all users: Print and sort the login names of all users:
BEGIN { FS = ":" } BEGIN { FS = ":" }
{ print $1 | "sort" } { print $1 | "sort" }
skipping to change at line 1731 skipping to change at line 1730
Run an external command for particular lines of data: Run an external command for particular lines of data:
tail -f access_log | tail -f access_log |
awk '/myhome.html/ { system("nmap " $1 ">> logdir/myhome.html") }' awk '/myhome.html/ { system("nmap " $1 ">> logdir/myhome.html") }'
ACKNOWLEDGEMENTS ACKNOWLEDGEMENTS
Brian Kernighan provided valuable assistance during testing and debugging . We thank him. Brian Kernighan provided valuable assistance during testing and debugging . We thank him.
COPYING PERMISSIONS COPYING PERMISSIONS
Copyright © 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2 Copyright © 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
001, 2002, 2003, 2004, 2005, , 2001, 2002, 2003, 2004, 2005,
2007, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, F 2007, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2
ree Software Foundation, Inc. 020, Free Software Foundation,
Inc.
Permission is granted to make and distribute verbatim copies of this man ual page provided the copyright Permission is granted to make and distribute verbatim copies of this man ual page provided the copyright
notice and this permission notice are preserved on all copies. notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this ma nual page under the conditions Permission is granted to copy and distribute modified versions of this ma nual page under the conditions
for verbatim copying, provided that the entire resulting derived work is distributed under the terms of for verbatim copying, provided that the entire resulting derived work is distributed under the terms of
a permission notice identical to this one. a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual page into another language, Permission is granted to copy and distribute translations of this manual page into another language,
under the above conditions for modified versions, except that this permi ssion notice may be stated in a under the above conditions for modified versions, except that this permi ssion notice may be stated in a
translation approved by the Foundation. translation approved by the Foundation.
Free Software Foundation May 22 2019 GAWK(1) Free Software Foundation Mar 23 2020 GAWK(1)
 End of changes. 188 change blocks. 
490 lines changed or deleted 490 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)