(gawk.info) User-modified
Info Catalog
(gawk.info) Built-in Variables
(gawk.info) Built-in Variables
(gawk.info) Auto-set
Built-in Variables that Control `awk'
=====================================
This is an alphabetical list of the variables which you can change to
control how `awk' does certain things. Those variables that are
specific to `gawk' are marked with an asterisk, `*'.
`CONVFMT'
This string controls conversion of numbers to strings (
Conversion of Strings and Numbers Conversion.). It works by
being passed, in effect, as the first argument to the `sprintf'
function ( Built-in Functions for String Manipulation String
Functions.). Its default value is `"%.6g"'. `CONVFMT' was
introduced by the POSIX standard.
`FIELDWIDTHS *'
This is a space separated list of columns that tells `gawk' how to
split input with fixed, columnar boundaries. It is an
experimental feature. Assigning to `FIELDWIDTHS' overrides the
use of `FS' for field splitting. Reading Fixed-width Data
Constant Size, for more information.
If `gawk' is in compatibility mode ( Command Line Options
Options.), then `FIELDWIDTHS' has no special meaning, and field
splitting operations are done based exclusively on the value of
`FS'.
`FS'
`FS' is the input field separator ( Specifying How Fields are
Separated Field Separators.). The value is a single-character
string or a multi-character regular expression that matches the
separations between fields in an input record. If the value is
the null string (`""'), then each character in the record becomes
a separate field.
The default value is `" "', a string consisting of a single space.
As a special exception, this value means that any sequence of
spaces, tabs, and/or newlines is a single separator.(1) It also
causes spaces, tabs, and newlines at the beginning and end of a
record to be ignored.
You can set the value of `FS' on the command line using the `-F'
option:
awk -F, 'PROGRAM' INPUT-FILES
If `gawk' is using `FIELDWIDTHS' for field-splitting, assigning a
value to `FS' will cause `gawk' to return to the normal,
`FS'-based, field splitting. An easy way to do this is to simply
say `FS = FS', perhaps with an explanatory comment.
`IGNORECASE *'
If `IGNORECASE' is non-zero or non-null, then all string
comparisons, and all regular expression matching are
case-independent. Thus, regexp matching with `~' and `!~', and
the `gensub', `gsub', `index', `match', `split' and `sub'
functions, record termination with `RS', and field splitting with
`FS' all ignore case when doing their particular regexp operations.
The value of `IGNORECASE' does _not_ affect array subscripting.
Case-sensitivity in Matching Case-sensitivity.
If `gawk' is in compatibility mode ( Command Line Options
Options.), then `IGNORECASE' has no special meaning, and string
and regexp operations are always case-sensitive.
`OFMT'
This string controls conversion of numbers to strings (
Conversion of Strings and Numbers Conversion.) for printing with
the `print' statement. It works by being passed, in effect, as
the first argument to the `sprintf' function ( Built-in
Functions for String Manipulation String Functions.). Its
default value is `"%.6g"'. Earlier versions of `awk' also used
`OFMT' to specify the format for converting numbers to strings in
general expressions; this is now done by `CONVFMT'.
`OFS'
This is the output field separator ( Output Separators).
It is output between the fields output by a `print' statement. Its
default value is `" "', a string consisting of a single space.
`ORS'
This is the output record separator. It is output at the end of
every `print' statement. Its default value is `"\n"'. (
Output Separators.)
`RS'
This is `awk''s input record separator. Its default value is a
string containing a single newline character, which means that an
input record consists of a single line of text. It can also be
the null string, in which case records are separated by runs of
blank lines, or a regexp, in which case records are separated by
matches of the regexp in the input text. ( How Input is
Split into Records Records.)
`SUBSEP'
`SUBSEP' is the subscript separator. It has the default value of
`"\034"', and is used to separate the parts of the indices of a
multi-dimensional array. Thus, the expression `foo["A", "B"]'
really accesses `foo["A\034B"]' ( Multi-dimensional Arrays
Multi-dimensional.).
---------- Footnotes ----------
(1) In POSIX `awk', newline does not count as whitespace.
Info Catalog
(gawk.info) Built-in Variables
(gawk.info) Built-in Variables
(gawk.info) Auto-set
automatically generated byinfo2html