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 an output redirection
(see section Redirecting Output of
The items to print can be constant strings or numbers, fields of the
current record (such as
$1), variables, or any
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 ""’.
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
expression, and you will probably get an error. Keep in mind that a
space is printed between any two items.
Note that the