GNU Info

Info Node: (gawk.info)Reading Files

(gawk.info)Reading Files


Next: Printing Prev: Regexp Up: Top
Enter node , (file) or (file)node

Reading Input Files
*******************

   In the typical `awk' program, all input is read either from the
standard input (by default, this is the keyboard but often it is a pipe
from another command), or from files whose names you specify on the
`awk' command line.  If you specify input files, `awk' reads them in
order, processing all the data from one before going on to the next.
The name of the current input file can be found in the built-in variable
`FILENAME' (Note: Built-in Variables).

   The input is read in units called "records", and is processed by the
rules of your program one record at a time.  By default, each record is
one line.  Each record is automatically split into chunks called
"fields".  This makes it more convenient for programs to work on the
parts of a record.

   On rare occasions, you may need to use the `getline' command.  The
`getline' command is valuable, both because it can do explicit input
from any number of files, and because the files used with it do not
have to be named on the `awk' command line (Note: Explicit Input with
`getline'.).

Records
Controlling how data is split into records.
Fields
An introduction to fields.
Non-Constant Fields
Non-constant Field Numbers.
Changing Fields
Changing the Contents of a Field.
Field Separators
The field separator and how to change it.
Constant Size
Reading constant width data.
Multiple Line
Reading multi-line records.
Getline
Reading files under explicit program control
using the `getline' function.

automatically generated by info2www version 1.2.2.9