Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
a
awk(1) awk(1)
DIAGNOSTICS
awk supports up to 199 fields ($1, $2, ..., $199) per record.
EXAMPLES
Print lines longer than 72 characters:
length > 72
Print first two fields in opposite order:
{ print $2, $1 }
Same, with input fields separated by comma and/or blanks and tabs:
BEGIN { FS = ",[ \t]*|[ \t]+" }
{ print $2, $1 }
Add up first column, print sum and average:
{s+=$1}"
END { print "sum is", s, " average is", s/NR }
Print all lines between start/stop pairs:
/start/, /stop/
Simulate echo command (see echo(1)):
BEGIN { # Simulate echo(1)
for (i = 1; i < ARGC; i++) printf "%s ", ARGV[i]
printf "\n"
exit }
AUTHOR
awk was developed by AT&T, IBM, OSF, and HP.
SEE ALSO
lex(1), sed(1).
A. V. Aho, B. W. Kernighan, P. J. Weinberger: The AWK Programming Language, Addison-Wesley, 1988.
STANDARDS CONFORMANCE
awk: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
Section 1−−38 − 5 − HP-UX Release 11i: December 2000
___
___