gawk: Reading Files
1
1 4 Reading Input Files
1 *********************
1
1 In the typical 'awk' program, 'awk' reads all input either from the
1 standard input (by default, this is the keyboard, but often it is a pipe
1 from another command) or from files whose names you specify on the 'awk'
1 command line. If you specify input files, 'awk' reads them in order,
1 processing all the data from one before going on to the next. The name
1 of the current input file can be found in the predefined variable
1 'FILENAME' (⇒Built-in Variables).
1
1 The input is read in units called "records", and is processed by the
1 rules of your program one record at a time. By default, each record is
1 one line. Each record is automatically split into chunks called
1 "fields". This makes it more convenient for programs to work on the
1 parts of a record.
1
1 On rare occasions, you may need to use the 'getline' command. The
1 'getline' command is valuable both because it can do explicit input from
1 any number of files, and because the files used with it do not have to
1 be named on the 'awk' command line (⇒Getline).
1
Menu