back toc next

I/O

print writes $0 ORS to standard output.
print expr1, expr2, ..., exprn writes expr1 OFS expr2 OFS ... exprn ORS to standard output.
printf format, expr-list duplicates the printf C library function writing to standard output.
print > file writes $0 ORS to file
getline reads into $0, updates the fields, NF, NR and FNR
getline < file reads into $0 from file, updates the fields and N
getline var reads the next record into var, updates NR and FNR
getline var < file reads the next record of file into var
command | getline pipes a record from command into $0 and updates the fields and NF
command | getline var pipes a record from command into var

Dividing even/odd pages of a Text (RFC)

Assuming the pages preformatted and separated by ^L (0x0c)

BEGIN{ job = 1 }

{ print > "txt.out." job }

/^\x0c$/ { job = job % 2 + 1 }