manpagez: man pages & more
info gawk
Home | html | info | man

File: gawk.info,  Node: Records,  Next: Fields,  Up: Reading Files

4.1 How Input Is Split into Records
===================================

'awk' divides the input for your program into records and fields.  It
keeps track of the number of records that have been read so far from the
current input file.  This value is stored in a predefined variable
called 'FNR', which is reset to zero every time a new file is started.
Another predefined variable, 'NR', records the total number of input
records read so far from all data files.  It starts at zero, but is
never automatically reset to zero.

   Normally, records are separated by newline characters.  You can
control how records are separated by assigning values to the built-in
variable 'RS'.  If 'RS' is any single character, that character
separates records.  Otherwise (in 'gawk'), 'RS' is treated as a regular
expression.  This mechanism is explained in greater detail shortly.

* Menu:

* awk split records::           How standard 'awk' splits records.
* gawk split records::          How 'gawk' splits records.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.