Previous: Full Line Fields, Up: Field Separators [Contents][Index]
It is important to remember that when you assign a string constant
as the value of FS
, it undergoes normal awk
string
processing. For example, with Unix awk
and gawk
,
the assignment ‘FS = "\.."
’ assigns the character string ".."
to FS
(the backslash is stripped). This creates a regexp meaning
“fields are separated by occurrences of any two characters.”
If instead you want fields to be separated by a literal period followed
by any single character, use ‘FS = "\\.."
’.
The following list summarizes how fields are split, based on the value
of FS
(‘==
’ means “is equal to”):
FS == " "
FS == any other single character
FS == regexp
regexp
. Leading and trailing matches of regexp
delimit empty fields.FS == ""
The FS = "c" IGNORECASE = 1 $0 = "aCa" print $1 The output is ‘ |
Previous: Full Line Fields, Up: Field Separators [Contents][Index]