AWK - quick reference
AWK awk is an extremely versatile pattern matching and processing language. Although "awk scripts" can be written simply on the command line, more sophisticated use involves script files. Where the shell language is geared to running various utilities, the awk language is geared to extracting information from files according to rules and patterns. As a programming language (which looks much like C in some respects), awk has the usual selection, loop, and condition constructs, and has variables. Awk variables are not referenced with a leading $ as in the shell, except for the variables representing fields in the input line: $1, $2, ... . See below. As with the shell, comments come after the # character. To invoke an awk script is similar to the first method for shell scripts (an awk script cannot be made executable, however, an executable shell script with a here-document for awk could be used): awk -f script-file input-files If is missing, awk looks for input from stdin. Th
Comments