GNU Info

Info Node: (gawk.info)Print

(gawk.info)Print


Next: Print Examples Prev: Printing Up: Printing
Enter node , (file) or (file)node

The `print' Statement
=====================

   The `print' statement is used to produce output with simple,
standardized formatting.  Specify only the strings or numbers to print,
in a list separated by commas.  They are output, separated by single
spaces, followed by a newline.  The statement looks like this:

     print ITEM1, ITEM2, ...

The entire list of items may be optionally enclosed in parentheses.  The
parentheses are necessary if any of the item expressions uses the `>'
relational operator; otherwise it could be confused with a redirection
(Note: Redirecting Output of `print' and `printf'.).

   The items to print can be constant strings or numbers, fields of the
current record (such as `$1'), variables, or any `awk' expression.
Numeric values are converted to strings and then printed.

   The simple statement `print' with no items is equivalent to `print
$0': it prints the entire current record.  To print a blank line, use
`print ""', where `""' is the empty string.  To print a fixed piece of
text, use a string constant, such as `"Don't Panic"', as one item.  If
you forget to use the double quote characters, your text is taken as an
`awk' expression and you will probably get an error.  Keep in mind that
a space is printed between any two items.


automatically generated by info2www version 1.2.2.9