Was this helpful?
IFS
The Internal Field Separator built-in variable contains a list of zero or more field separators. Each field separator is one character. These characters are used to split a string into fields. It is initially assigned a null value that indicates that no separator will be recognized. If IFS is set, then each input line is automatically divided up into fields (named $1, $2, etc.) according to the IFS.
A blank as a separator will split the input line into fields separated by one or more blanks and/or tabs (unless TABS is set to 0). A separator character other than a blank will split the input line into fields separated by each single occurrence of that character.
In general, the field separator or separators will remain the same throughout the data file. However, CXL supports cases where there are sections in a file that use a different field separator. In these cases, the IFS variable should be set before the start of the sections that require a different field separator.
Example
BEGIN {IFS = ":"}
# Splits the input line into fields containing text between colons.
BEGIN {IFS = ":* "}
# Splits the input line into fields containing text between
# colons, between asterisks, and between blank space.
BEGIN {IFS = chr(10)}
# Splits the input line into fields containing text between line
# feed characters.
Last modified date: 02/09/2024