http://www.usf.uos.de/infoservice/doc/

(gawk.info)Language Summary


Next: Variables/Fields Prev: Command Line Summary Up: Gawk Summary
Enter node , (file) or (file)node

Language Summary
================

   An `awk' program consists of a sequence of zero or more
pattern-action statements and optional function definitions.  One or
the other of the pattern and action may be omitted.

     PATTERN    { ACTION STATEMENTS }
     PATTERN
               { ACTION STATEMENTS }
     
     function NAME(PARAMETER LIST)     { ACTION STATEMENTS }

   `gawk' first reads the program source from the PROGRAM-FILE(s), if
specified, or from the first non-option argument on the command line.
The `-f' option may be used multiple times on the command line.  `gawk'
reads the program text from all the PROGRAM-FILE files, effectively
concatenating them in the order they are specified.  This is useful for
building libraries of `awk' functions, without having to include them
in each new `awk' program that uses them.  To use a library function in
a file from a program typed in on the command line, specify `--source
'PROGRAM'', and type your program in between the single quotes.  Note:
Command Line Options.

   The environment variable `AWKPATH' specifies a search path to use
when finding source files named with the `-f' option.  The default
path, which is `.:/usr/local/share/awk'(1) is used if `AWKPATH' is not
set.  If a file name given to the `-f' option contains a `/' character,
no path search is performed.  *Note The `AWKPATH' Environment Variable:
AWKPATH Variable.

   `gawk' compiles the program into an internal form, and then proceeds
to read each file named in the `ARGV' array.  The initial values of
`ARGV' come from the command line arguments.  If there are no files
named on the command line, `gawk' reads the standard input.

   If a "file" named on the command line has the form `VAR=VAL', it is
treated as a variable assignment: the variable VAR is assigned the
value VAL.  If any of the files have a value that is the null string,
that element in the list is skipped.

   For each record in the input, `gawk' tests to see if it matches any
PATTERN in the `awk' program.  For each pattern that the record
matches, the associated ACTION is executed.

   ---------- Footnotes ----------

   (1)  The path may use a directory other than `/usr/local/share/awk',
depending upon how `gawk' was built and installed.


Next: Variables/Fields Prev: Command Line Summary Up: Gawk Summary
[ Dokumentation lokal installierter Software ]