MPE/iX Shell and Utilities Reference Manual, Vol 1

awk(1) MPE/iX Shell and Utilities awk(1)
return [expr]
returns from the execution of a function. If you specify an expr, the function returns the value
of the expression as its result; otherwise, the function result is undefined.
delete array[i]
deletes element i from the given array.
print expr, expr, ...
is described in the Output subsection.
printf fmt, expr, expr, ...
is also described in the Output subsection.
Output
The print statement prints its arguments with only simple formatting. If it has no argu-
ments, it prints the current input record in its entirety. awk adds the output record separator
ORS to the end of the output that each print statement produces; when commas separate
arguments in the print statement, the output field separator OFS separates the corresponding
output values. ORS and OFS are built-in variables, the values of which you can change by
assigning them strings. The default output record separator is a newline and the default output
field separator is a space.
The variable OFMT gives the format of floating point numbers output by print. By default,
the value is %.6g; you can change this by assigning OFMT a different string value. OFMT
only applies to floating point numbers (ones with fractional parts).
The printf statement formats its arguments using the fmt argument. Formatting is the same
as for the built-in function sprintf. Unlike print, printf does not add output separators
automatically. This gives the program more precise control of the output.
The print and printf statements write to the standard output. You can redirect output to a
file or pipe as described later.
If you add >expr to a print or printf statement, awk treats the string value of expr as a
file name, and writes output to that file. Similarly, if you add >>expr, awk appends output to
the current contents of the file. The distinction between > and >> is only important for the
first print to the file expr. Subsequent outputs to an already open file append to what is there
already.
To eliminate ambiguities, statements such as
printa>bc
are syntactically illegal. Use parentheses to resolve the ambiguity.
Commands and Utilities 1-31