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 of OFS and terminated by the value of ORS. OFMT provides the conversion format for numeric values for the print 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 and printf 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 or printf 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.