aawwkk -- Command

Pattern-scanning language
aawwkk [-yy][-FF_c][-ff _p_r_o_g_f_i_l_e][_p_r_o_g][_f_i_l_e ...]

aawwkk is a general-purpose  language designed for processing input data.  Its
features  allow  you to  write  programs that  scan  for patterns,  produce
reports, and  filter relevant  information from a  mass of input  data.  It
acts  on each  input _f_i_l_e  following  the commands  you write  into an  aawwkk
program.   aawwkk reads  the standard  input  if no  _f_i_l_e is  specified, which
allows it  to act as  a filter in a  pipeline; the _f_i_l_e name  `-' means the
standard input.

You can specify the program either as an argument _p_r_o_g (usually enclosed in
quotation marks to prevent interpretation by the shell sshh) or in the form -
ff  _p_r_o_g_f_i_l_e, where  _p_r_o_g_f_i_l_e contains  the  aawwkk program.   If no  -ff option
appears, the first non-option argument is the aawwkk program _p_r_o_g.

The option flag -yy specifies  that any lower-case alphabetic character in a
regular expression  pattern should match both  itself and the corresponding
upper-case letter.  This is identical to the matching found in the pattern-
matching program ggrreepp with the -yy option.

aawwkk views  its input as a  sequence of records, each  consisting of zero or
more fields.  By default, newlines separate records and white space (spaces
or  tabs)  separates  fields.   The  option  -FF_c changes  the  input  field
separator characters to the characters in  the string _c. An aawwkk program can
also change  the field and  record separators.  The program  can access the
values of each field and the entire record through built-in variables.

For details  on the construction  of aawwkk programs, consult  the tutorial to
aawwkk that appears  in this manual.  Briefly, an aawwkk  program consists of one
or more lines, each containing a  _p_a_t_t_e_r_n or an _a_c_t_i_o_n, or both.  A _p_a_t_t_e_r_n
determines whether  aawwkk performs the  associated _a_c_t_i_o_n. It  may consist of
regular expressions,  line ranges,  boolean combinations of  variables, and
beginning and  end of input-text  predicates.  If no  _p_a_t_t_e_r_n is specified,
aawwkk executes the _a_c_t_i_o_n (the pattern matches by default).

An _a_c_t_i_o_n  is enclosed  in braces.   The syntax of  actions is  C-like, and
consists  of  simple and  compound  statements  constructed from  constants
(numbers, strings), input  fields, built-in and user-defined variables, and
built-in functions.   If an _a_c_t_i_o_n is missing, aawwkk  prints the entire input
record (line).

Unlike lleexx or yyaacccc, aawwkk does not compile programs into an executable image,
but interprets them  directly.  Thus, aawwkk is ideal for quickly-implemented,
one-shot efforts.

_L_i_m_i_t_s
The COHERENT  implementation of aawwkk sets the following  limits on input and
output:

     Characters per input record        399
     Characters per output record       399
     Characters per field               399

_E_x_a_m_p_l_e_s
The  following  examples  illustrate  the  economy  of  expression  of  aawwkk
programs.

The first example reads the  standad input, and echoes all lines containing
the string ``COHERENT'':

    awk '/COHERENT/'

To exit, type <ccttrrll-DD>/

The built-in  variable NNRR is the  number of the current  input record.  The
next example reads the standard input, and prints the number of records you
typed after you exit (again, by typing <ccttrrll-DD>):

    awk 'END { print NR }'

The built-in variable $33 gives the  value of the third field of the current
record.  The last example sums the third field from each record you type on
the standard input, and prints the total when you exit:

    awk '{ sum += $3 }
        END { print sum }'

_S_e_e _A_l_s_o
ccoommmmaannddss, ggrreepp, lleexx, sseedd, yyaacccc
_I_n_t_r_o_d_u_c_t_i_o_n _t_o _t_h_e _a_w_k _L_a_n_g_u_a_g_e

_N_o_t_e_s
There is no way to have  a null field, such as is necessary to describe the
colon-separated fields in /eettcc/ppaasssswwdd.

aawwkk converts  between strings and numbers automatically.   Adding zero to a
string forces  aawwkk to treat  it as a  number; concatenating ""  to a number
forces aawwkk to treat it as a string.
