[Home]
HomePage RecentChanges Frequently Asked Questions

input

The awk utility can take its input from [[standard_input?]] or from files. If no input files are specified at the command line, then awk will take its input from [[standard_input?]].

Input is separated into records

In awk all input is separated into records and each record is sequentially processed according to the rules defined within the awk script. By default, each line of input is treated as a single [record] (or row of data).

Records are further divided into fields

In awk, records are further divided into fields, making them easy to manage, because processing can take place against a particular data field.

Taking input from files

The awk utility reads its input files in the order provided and performs its [[pattern_matching?]] cycle until all lines of input have been read.

Obtaining input using getline

The getline command enables awk to take input from a particular file without the need to specify the filename as a command line parameter.

Special variables related to input

The following special variables are related to input:

*Variable* *Description*
FNR An informative variable that provides the record number within the current file
FS A control variable that specifies the input field separator
NF An informative variable that provides the number of fields within the current record
[[NR?]] An informative variable that provides the total number of records processed
RS A control variable that specifies the input record separator

Edit this page View other revisions Administration
Last edited 2011年05月19日 22:40 UTC by markhobley (diff)

Powered by sdf Creative Commons License <pierre.gaston+awk@gmail.com>

Awk Wiki by #awk is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

AltStyle によって変換されたページ (->オリジナル) /