Previous: Getline Notes, Up: Getline


4.9.10 Summary of getline Variants

table-getline-variants summarizes the eight variants of getline, listing which built-in variables are set by each one, and whether the variant is standard or a gawk extension. Note: for each variant, gawk sets the RT built-in variable.

Variant Effect Standard / Extension
getline Sets $0, NF, FNR, NR, and RT Standard
getline var Sets var, FNR, NR, and RT Standard
getline < file Sets $0, NF, and RT Standard
getline var < file Sets var and RT Standard
command | getline Sets $0, NF, and RT Standard
command | getline var Sets var and RT Standard
command |& getline Sets $0, NF, and RT Extension
command |& getline var Sets var and RT Extension

Table 4.1: getline Variants and What They Set