Go forward to Time Functions.
Go backward to String Functions.
Go up to Built-in.

Built-in Functions for Input/Output
===================================

`close(FILENAME)'
     Close the file FILENAME, for input or output.  The argument may
     alternatively be a shell command that was used for redirecting to
     or from a pipe; then the pipe is closed.

     See Closing Input Files and Pipes: Close Input, regarding closing
     input files and pipes.  See Closing Output Files and Pipes: Close Output, regarding closing output files and pipes.

`system(COMMAND)'
     The system function allows the user to execute operating system
     commands and then return to the `awk' program.  The `system'
     function executes the command given by the string COMMAND.  It
     returns, as its value, the status returned by the command that was
     executed.

     For example, if the following fragment of code is put in your `awk'
     program:

          END {
               system("mail -s 'awk run done' operator < /dev/null")
          }

     the system operator will be sent mail when the `awk' program
     finishes processing input and begins its end-of-input processing.

     Note that much the same result can be obtained by redirecting
     `print' or `printf' into a pipe.  However, if your `awk' program
     is interactive, `system' is useful for cranking up large
     self-contained programs, such as a shell or an editor.

     Some operating systems cannot implement the `system' function.
     `system' causes a fatal error if it is not supported.

Controlling Output Buffering with `system'
------------------------------------------

   Many utility programs will "buffer" their output; they save
information to be written to a disk file or terminal in memory, until
there is enough to be written in one operation.  This is often more
efficient than writing every little bit of information as soon as it is
ready.  However, sometimes it is necessary to force a program to
"flush" its buffers; that is, write the information to its destination,
even if a buffer is not full.  You can do this from your `awk' program
by calling `system' with a null string as its argument:

     system("")   # flush output

`gawk' treats this use of the `system' function as a special case, and
is smart enough not to run a shell (or other command interpreter) with
the empty command.  Therefore, with `gawk', this idiom is not only
useful, it is efficient.  While this idiom should work with other `awk'
implementations, it will not necessarily avoid starting an unnecessary
shell.