Gawk/Output-Summary
From Get docs
Next: Output Exercises, Previous: Nonfatal, Up: Printing [Contents][Index]
5.11 Summary
- The
print
statement prints comma-separated expressions. Each expression is separated by the value ofOFS
and terminated by the value ofORS
.OFMT
provides the conversion format for numeric values for theprint
statement. - The
printf
statement provides finer-grained control over output, with format-control letters for different data types and various flags that modify the behavior of the format-control letters. - Output from both
print
andprintf
may be redirected to files, pipes, and coprocesses. gawk
provides special file names for access to standard input, output, and error, and for network communications.- Use
close()
to close open file, pipe, and coprocess redirections. For coprocesses, it is possible to close only one direction of the communications. - Normally errors with
print
orprintf
are fatal.gawk
lets you make output errors be nonfatal either for all files or on a per-file basis. You must then check for errors after every relevant output statement.