Output Summary (The GNU Awk User’s Guide)
From Get docs
Gawk/docs/latest/Output-Summary
Next: Output Exercises, Previous: Nonfatal, Up: Printing [Contents][Index]
5.11 Summary
- The
printstatement prints comma-separated expressions. Each expression is separated by the value ofOFSand terminated by the value ofORS.OFMTprovides the conversion format for numeric values for theprintstatement. - The
printfstatement 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
printandprintfmay be redirected to files, pipes, and coprocesses. gawkprovides 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
printorprintfare fatal.gawklets 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.