home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gawk-2.15.6-bin.lha / info / gawk.info-7 (.txt) < prev    next >
GNU Info File  |  1996-10-12  |  50KB  |  924 lines

  1. This is Info file gawk.info, produced by Makeinfo-1.55 from the input
  2. file /gnu-src/gawk-2.15.6/gawk.texi.
  3.    This file documents `awk', a program that you can use to select
  4. particular records in a file and perform operations upon them.
  5.    This is Edition 0.15 of `The GAWK Manual',
  6. for the 2.15 version of the GNU implementation
  7. of AWK.
  8.    Copyright (C) 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: gawk.info,  Node: V7/S5R3.1,  Next: S5R4,  Prev: Language History,  Up: Language History
  21. Major Changes between V7 and S5R3.1
  22. ===================================
  23.    The `awk' language evolved considerably between the release of
  24. Version 7 Unix (1978) and the new version first made widely available in
  25. System V Release 3.1 (1987).  This section summarizes the changes, with
  26. cross-references to further details.
  27.    * The requirement for `;' to separate rules on a line (*note `awk'
  28.      Statements versus Lines: Statements/Lines.).
  29.    * User-defined functions, and the `return' statement (*note
  30.      User-defined Functions: User-defined.).
  31.    * The `delete' statement (*note The `delete' Statement: Delete.).
  32.    * The `do'-`while' statement (*note The `do'-`while' Statement: Do
  33.      Statement.).
  34.    * The built-in functions `atan2', `cos', `sin', `rand' and `srand'
  35.      (*note Numeric Built-in Functions: Numeric Functions.).
  36.    * The built-in functions `gsub', `sub', and `match' (*note Built-in
  37.      Functions for String Manipulation: String Functions.).
  38.    * The built-in functions `close', which closes an open file, and
  39.      `system', which allows the user to execute operating system
  40.      commands (*note Built-in Functions for Input/Output: I/O
  41.      Functions.).
  42.    * The `ARGC', `ARGV', `FNR', `RLENGTH', `RSTART', and `SUBSEP'
  43.      built-in variables (*note Built-in Variables::.).
  44.    * The conditional expression using the operators `?' and `:' (*note
  45.      Conditional Expressions: Conditional Exp.).
  46.    * The exponentiation operator `^' (*note Arithmetic Operators:
  47.      Arithmetic Ops.) and its assignment operator form `^=' (*note
  48.      Assignment Expressions: Assignment Ops.).
  49.    * C-compatible operator precedence, which breaks some old `awk'
  50.      programs (*note Operator Precedence (How Operators Nest):
  51.      Precedence.).
  52.    * Regexps as the value of `FS' (*note Specifying how Fields are
  53.      Separated: Field Separators.), and as the third argument to the
  54.      `split' function (*note Built-in Functions for String
  55.      Manipulation: String Functions.).
  56.    * Dynamic regexps as operands of the `~' and `!~' operators (*note
  57.      How to Use Regular Expressions: Regexp Usage.).
  58.    * Escape sequences (*note Constant Expressions: Constants.) in
  59.      regexps.
  60.    * The escape sequences `\b', `\f', and `\r' (*note Constant
  61.      Expressions: Constants.).
  62.    * Redirection of input for the `getline' function (*note Explicit
  63.      Input with `getline': Getline.).
  64.    * Multiple `BEGIN' and `END' rules (*note `BEGIN' and `END' Special
  65.      Patterns: BEGIN/END.).
  66.    * Simulated multi-dimensional arrays (*note Multi-dimensional
  67.      Arrays: Multi-dimensional.).
  68. File: gawk.info,  Node: S5R4,  Next: POSIX,  Prev: V7/S5R3.1,  Up: Language History
  69. Changes between S5R3.1 and S5R4
  70. ===============================
  71.    The System V Release 4 version of Unix `awk' added these features
  72. (some of which originated in `gawk'):
  73.    * The `ENVIRON' variable (*note Built-in Variables::.).
  74.    * Multiple `-f' options on the command line (*note Invoking `awk':
  75.      Command Line.).
  76.    * The `-v' option for assigning variables before program execution
  77.      begins (*note Invoking `awk': Command Line.).
  78.    * The `--' option for terminating command line options.
  79.    * The `\a', `\v', and `\x' escape sequences (*note Constant
  80.      Expressions: Constants.).
  81.    * A defined return value for the `srand' built-in function (*note
  82.      Numeric Built-in Functions: Numeric Functions.).
  83.    * The `toupper' and `tolower' built-in string functions for case
  84.      translation (*note Built-in Functions for String Manipulation:
  85.      String Functions.).
  86.    * A cleaner specification for the `%c' format-control letter in the
  87.      `printf' function (*note Using `printf' Statements for Fancier
  88.      Printing: Printf.).
  89.    * The ability to dynamically pass the field width and precision
  90.      (`"%*.*d"') in the argument list of the `printf' function (*note
  91.      Using `printf' Statements for Fancier Printing: Printf.).
  92.    * The use of constant regexps such as `/foo/' as expressions, where
  93.      they are equivalent to use of the matching operator, as in `$0 ~
  94.      /foo/' (*note Constant Expressions: Constants.).
  95. File: gawk.info,  Node: POSIX,  Next: POSIX/GNU,  Prev: S5R4,  Up: Language History
  96. Changes between S5R4 and POSIX `awk'
  97. ====================================
  98.    The POSIX Command Language and Utilities standard for `awk'
  99. introduced the following changes into the language:
  100.    * The use of `-W' for implementation-specific options.
  101.    * The use of `CONVFMT' for controlling the conversion of numbers to
  102.      strings (*note Conversion of Strings and Numbers: Conversion.).
  103.    * The concept of a numeric string, and tighter comparison rules to go
  104.      with it (*note Comparison Expressions: Comparison Ops.).
  105.    * More complete documentation of many of the previously undocumented
  106.      features of the language.
  107. File: gawk.info,  Node: POSIX/GNU,  Prev: POSIX,  Up: Language History
  108. Extensions in `gawk' not in POSIX `awk'
  109. =======================================
  110.    The GNU implementation, `gawk', adds these features:
  111.    * The `AWKPATH' environment variable for specifying a path search for
  112.      the `-f' command line option (*note Invoking `awk': Command Line.).
  113.    * The various `gawk' specific features available via the `-W'
  114.      command line option (*note Invoking `awk': Command Line.).
  115.    * The `ARGIND' variable, that tracks the movement of `FILENAME'
  116.      through `ARGV'.  (*note Built-in Variables::.).
  117.    * The `ERRNO' variable, that contains the system error message when
  118.      `getline' returns -1, or when `close' fails.  (*note Built-in
  119.      Variables::.).
  120.    * The `IGNORECASE' variable and its effects (*note Case-sensitivity
  121.      in Matching: Case-sensitivity.).
  122.    * The `FIELDWIDTHS' variable and its effects (*note Reading
  123.      Fixed-width Data: Constant Size.).
  124.    * The `next file' statement for skipping to the next data file
  125.      (*note The `next file' Statement: Next File Statement.).
  126.    * The `systime' and `strftime' built-in functions for obtaining and
  127.      printing time stamps (*note Functions for Dealing with Time
  128.      Stamps: Time Functions.).
  129.    * The `/dev/stdin', `/dev/stdout', `/dev/stderr', and `/dev/fd/N'
  130.      file name interpretation (*note Standard I/O Streams: Special
  131.      Files.).
  132.    * The `-W compat' option to turn off these extensions (*note
  133.      Invoking `awk': Command Line.).
  134.    * The `-W posix' option for full POSIX compliance (*note Invoking
  135.      `awk': Command Line.).
  136. File: gawk.info,  Node: Installation,  Next: Gawk Summary,  Prev: Language History,  Up: Top
  137. Installing `gawk'
  138. *****************
  139.    This chapter provides instructions for installing `gawk' on the
  140. various platforms that are supported by the developers.  The primary
  141. developers support Unix (and one day, GNU), while the other ports were
  142. contributed.  The file `ACKNOWLEDGMENT' in the `gawk' distribution
  143. lists the electronic mail addresses of the people who did the
  144. respective ports.
  145. * Menu:
  146. * Gawk Distribution::           What is in the `gawk' distribution.
  147. * Unix Installation::           Installing `gawk' under various versions
  148.                                 of Unix.
  149. * VMS Installation::            Installing `gawk' on VMS.
  150. * MS-DOS Installation::         Installing `gawk' on MS-DOS.
  151. * Atari Installation::          Installing `gawk' on the Atari ST.
  152. File: gawk.info,  Node: Gawk Distribution,  Next: Unix Installation,  Prev: Installation,  Up: Installation
  153. The `gawk' Distribution
  154. =======================
  155.    This section first describes how to get and extract the `gawk'
  156. distribution, and then discusses what is in the various files and
  157. subdirectories.
  158. * Menu:
  159. * Extracting::                  How to get and extract the distribution.
  160. * Distribution contents::       What is in the distribution.
  161. File: gawk.info,  Node: Extracting,  Next: Distribution contents,  Prev: Gawk Distribution,  Up: Gawk Distribution
  162. Getting the `gawk' Distribution
  163. -------------------------------
  164.    `gawk' is distributed as a `tar' file compressed with the GNU Zip
  165. program, `gzip'.  You can get it via anonymous `ftp' to the Internet
  166. host `prep.ai.mit.edu'.  Like all GNU software, it will be archived at
  167. other well known systems, from which it will be possible to use some
  168. sort of anonymous `uucp' to obtain the distribution as well.  You can
  169. also order `gawk' on tape or CD-ROM directly from the Free Software
  170. Foundation.  (The address is on the copyright page.) Doing so directly
  171. contributes to the support of the foundation and to the production of
  172. more free software.
  173.    Once you have the distribution (for example, `gawk-2.15.0.tar.z'),
  174. first use `gzip' to expand the file, and then use `tar' to extract it.
  175. You can use the following pipeline to produce the `gawk' distribution:
  176.      # Under System V, add 'o' to the tar flags
  177.      gzip -d -c gawk-2.15.0.tar.z | tar -xvpf -
  178. This will create a directory named `gawk-2.15' in the current directory.
  179.    The distribution file name is of the form `gawk-2.15.N.tar.Z'.  The
  180. N represents a "patchlevel", meaning that minor bugs have been fixed in
  181. the major release.  The current patchlevel is 0, but when retrieving
  182. distributions, you should get the version with the highest patchlevel.
  183.    If you are not on a Unix system, you will need to make other
  184. arrangements for getting and extracting the `gawk' distribution.  You
  185. should consult a local expert.
  186. File: gawk.info,  Node: Distribution contents,  Prev: Extracting,  Up: Gawk Distribution
  187. Contents of the `gawk' Distribution
  188. -----------------------------------
  189.    `gawk' has a number of C source files, documentation files,
  190. subdirectories and files related to the configuration process (*note
  191. Compiling and Installing `gawk' on Unix: Unix Installation.), and
  192. several subdirectories related to different, non-Unix, operating
  193. systems.
  194. various `.c', `.y', and `.h' files
  195.      The C and YACC source files are the actual `gawk' source code.
  196. `README'
  197. `README.VMS'
  198. `README.dos'
  199. `README.rs6000'
  200. `README.ultrix'
  201.      Descriptive files: `README' for `gawk' under Unix, and the rest
  202.      for the various hardware and software combinations.
  203. `PORTS'
  204.      A list of systems to which `gawk' has been ported, and which have
  205.      successfully run the test suite.
  206. `ACKNOWLEDGMENT'
  207.      A list of the people who contributed major parts of the code or
  208.      documentation.
  209. `NEWS'
  210.      A list of changes to `gawk' since the last release or patch.
  211. `COPYING'
  212.      The GNU General Public License.
  213. `FUTURES'
  214.      A brief list of features and/or changes being contemplated for
  215.      future releases, with some indication of the time frame for the
  216.      feature, based on its difficulty.
  217. `LIMITATIONS'
  218.      A list of those factors that limit `gawk''s performance.  Most of
  219.      these depend on the hardware or operating system software, and are
  220.      not limits in `gawk' itself.
  221. `PROBLEMS'
  222.      A file describing known problems with the current release.
  223. `gawk.1'
  224.      The `troff' source for a manual page describing `gawk'.
  225. `gawk.texinfo'
  226.      The `texinfo' source file for this Info file.  It should be
  227.      processed with TeX to produce a printed manual, and with
  228.      `makeinfo' to produce the Info file.
  229. `Makefile.in'
  230. `config'
  231. `config.in'
  232. `configure'
  233. `missing'
  234. `mungeconf'
  235.      These files and subdirectories are used when configuring `gawk'
  236.      for various Unix systems.  They are explained in detail in *Note
  237.      Compiling and Installing `gawk' on Unix: Unix Installation.
  238. `atari'
  239.      Files needed for building `gawk' on an Atari ST.  *Note Installing
  240.      `gawk' on the Atari ST: Atari Installation, for details.
  241.      Files needed for building `gawk' under MS-DOS.  *Note Installing
  242.      `gawk' on MS-DOS: MS-DOS Installation, for details.
  243. `vms'
  244.      Files needed for building `gawk' under VMS.  *Note Compiling
  245.      Installing and Running `gawk' on VMS: VMS Installation, for
  246.      details.
  247. `test'
  248.      Many interesting `awk' programs, provided as a test suite for
  249.      `gawk'.  You can use `make test' from the top level `gawk'
  250.      directory to run your version of `gawk' against the test suite.
  251.      If `gawk' successfully passes `make test' then you can be
  252.      confident of a successful port.
  253. File: gawk.info,  Node: Unix Installation,  Next: VMS Installation,  Prev: Gawk Distribution,  Up: Installation
  254. Compiling and Installing `gawk' on Unix
  255. =======================================
  256.    Often, you can compile and install `gawk' by typing only two
  257. commands.  However, if you do not use a supported system, you may need
  258. to configure `gawk' for your system yourself.
  259. * Menu:
  260. * Quick Installation::          Compiling `gawk' on a
  261.                                 supported Unix version.
  262. * Configuration Philosophy::    How it's all supposed to work.
  263. * New Configurations::          What to do if there is no supplied
  264.                                 configuration for your system.
  265. File: gawk.info,  Node: Quick Installation,  Next: Configuration Philosophy,  Prev: Unix Installation,  Up: Unix Installation
  266. Compiling `gawk' for a Supported Unix Version
  267. ---------------------------------------------
  268.    After you have extracted the `gawk' distribution, `cd' to
  269. `gawk-2.15'.  Look in the `config' subdirectory for a file that matches
  270. your hardware/software combination.  In general, only the software is
  271. relevant; for example `sunos41' is used for SunOS 4.1, on both Sun 3
  272. and Sun 4 hardware.
  273.    If you find such a file, run the command:
  274.      # assume you have SunOS 4.1
  275.      ./configure sunos41
  276.    This produces a `Makefile' and `config.h' tailored to your system.
  277. You may wish to edit the `Makefile' to use a different C compiler, such
  278. as `gcc', the GNU C compiler, if you have it.  You may also wish to
  279. change the `CFLAGS' variable, which controls the command line options
  280. that are passed to the C compiler (such as optimization levels, or
  281. compiling for debugging).
  282.    After you have configured `Makefile' and `config.h', type:
  283.      make
  284. and shortly thereafter, you should have an executable version of `gawk'.
  285. That's all there is to it!
  286. File: gawk.info,  Node: Configuration Philosophy,  Next: New Configurations,  Prev: Quick Installation,  Up: Unix Installation
  287. The Configuration Process
  288. -------------------------
  289.    (This section is of interest only if you know something about using
  290. the C language and the Unix operating system.)
  291.    The source code for `gawk' generally attempts to adhere to industry
  292. standards wherever possible.  This means that `gawk' uses library
  293. routines that are specified by the ANSI C standard and by the POSIX
  294. operating system interface standard.  When using an ANSI C compiler,
  295. function prototypes are provided to help improve the compile-time
  296. checking.
  297.    Many older Unix systems do not support all of either the ANSI or the
  298. POSIX standards.  The `missing' subdirectory in the `gawk' distribution
  299. contains replacement versions of those subroutines that are most likely
  300. to be missing.
  301.    The `config.h' file that is created by the `configure' program
  302. contains definitions that describe features of the particular operating
  303. system where you are attempting to compile `gawk'.  For the most part,
  304. it lists which standard subroutines are *not* available.  For example,
  305. if your system lacks the `getopt' routine, then `GETOPT_MISSING' would
  306. be defined.
  307.    `config.h' also defines constants that describe facts about your
  308. variant of Unix.  For example, there may not be an `st_blksize' element
  309. in the `stat' structure.  In this case `BLKSIZE_MISSING' would be
  310. defined.
  311.    Based on the list in `config.h' of standard subroutines that are
  312. missing, `missing.c' will do a `#include' of the appropriate file(s)
  313. from the `missing' subdirectory.
  314.    Conditionally compiled code in the other source files relies on the
  315. other definitions in the `config.h' file.
  316.    Besides creating `config.h', `configure' produces a `Makefile' from
  317. `Makefile.in'.  There are a number of lines in `Makefile.in' that are
  318. system or feature specific.  For example, there is line that begins
  319. with `##MAKE_ALLOCA_C##'.  This is normally a comment line, since it
  320. starts with `#'.  If a configuration file has `MAKE_ALLOCA_C' in it,
  321. then `configure' will delete the `##MAKE_ALLOCA_C##' from the beginning
  322. of the line.  This will enable the rules in the `Makefile' that use a C
  323. version of `alloca'.  There are several similar features that work in
  324. this fashion.
  325. File: gawk.info,  Node: New Configurations,  Prev: Configuration Philosophy,  Up: Unix Installation
  326. Configuring `gawk' for a New System
  327. -----------------------------------
  328.    (This section is of interest only if you know something about using
  329. the C language and the Unix operating system, and if you have to install
  330. `gawk' on a system that is not supported by the `gawk' distribution.
  331. If you are a C or Unix novice, get help from a local expert.)
  332.    If you need to configure `gawk' for a Unix system that is not
  333. supported in the distribution, first see *Note The Configuration
  334. Process: Configuration Philosophy.  Then, copy `config.in' to
  335. `config.h', and copy `Makefile.in' to `Makefile'.
  336.    Next, edit both files.  Both files are liberally commented, and the
  337. necessary changes should be straightforward.
  338.    While editing `config.h', you need to determine what library
  339. routines you do or do not have by consulting your system documentation,
  340. or by perusing your actual libraries using the `ar' or `nm' utilities.
  341. In the worst case, simply do not define *any* of the macros for missing
  342. subroutines.  When you compile `gawk', the final link-editing step will
  343. fail.  The link editor will provide you with a list of unresolved
  344. external references--these are the missing subroutines.  Edit
  345. `config.h' again and recompile, and you should be set.
  346.    Editing the `Makefile' should also be straightforward.  Enable or
  347. disable the lines that begin with `##MAKE_WHATEVER##', as appropriate.
  348. Select the correct C compiler and `CFLAGS' for it.  Then run `make'.
  349.    Getting a correct configuration is likely to be an iterative process.
  350. Do not be discouraged if it takes you several tries.  If you have no
  351. luck whatsoever, please report your system type, and the steps you took.
  352. Once you do have a working configuration, please send it to the
  353. maintainers so that support for your system can be added to the
  354. official release.
  355.    *Note Reporting Problems and Bugs: Bugs, for information on how to
  356. report problems in configuring `gawk'.  You may also use the same
  357. mechanisms for sending in new configurations.
  358. File: gawk.info,  Node: VMS Installation,  Next: MS-DOS Installation,  Prev: Unix Installation,  Up: Installation
  359. Compiling, Installing, and Running `gawk' on VMS
  360. ================================================
  361.    This section describes how to compile and install `gawk' under VMS.
  362. * Menu:
  363. * VMS Compilation::             How to compile `gawk' under VMS.
  364. * VMS Installation Details::    How to install `gawk' under VMS.
  365. * VMS Running::                 How to run `gawk' under VMS.
  366. * VMS POSIX::                   Alternate instructions for VMS POSIX.
  367. File: gawk.info,  Node: VMS Compilation,  Next: VMS Installation Details,  Prev: VMS Installation,  Up: VMS Installation
  368. Compiling `gawk' under VMS
  369. --------------------------
  370.    To compile `gawk' under VMS, there is a `DCL' command procedure that
  371. will issue all the necessary `CC' and `LINK' commands, and there is
  372. also a `Makefile' for use with the `MMS' utility.  From the source
  373. directory, use either
  374.      $ @[.VMS]VMSBUILD.COM
  375.      $ MMS/DESCRIPTION=[.VMS]DECSRIP.MMS GAWK
  376.    Depending upon which C compiler you are using, follow one of the sets
  377. of instructions in this table:
  378. VAX C V3.x
  379.      Use either `vmsbuild.com' or `descrip.mms' as is.  These use
  380.      `CC/OPTIMIZE=NOLINE', which is essential for Version 3.0.
  381. VAX C V2.x
  382.      You must have Version 2.3 or 2.4; older ones won't work.  Edit
  383.      either `vmsbuild.com' or `descrip.mms' according to the comments
  384.      in them.  For `vmsbuild.com', this just entails removing two `!'
  385.      delimiters.  Also edit `config.h' (which is a copy of file
  386.      `[.config]vms-conf.h') and comment out or delete the two lines
  387.      `#define __STDC__ 0' and `#define VAXC_BUILTINS' near the end.
  388. GNU C
  389.      Edit `vmsbuild.com' or `descrip.mms'; the changes are different
  390.      from those for VAX C V2.x, but equally straightforward.  No
  391.      changes to `config.h' should be needed.
  392. DEC C
  393.      Edit `vmsbuild.com' or `descrip.mms' according to their comments.
  394.      No changes to `config.h' should be needed.
  395.    `gawk' 2.15 has been tested under VAX/VMS 5.5-1 using VAX C V3.2,
  396. GNU C 1.40 and 2.3.  It should work without modifications for VMS V4.6
  397. and up.
  398. File: gawk.info,  Node: VMS Installation Details,  Next: VMS Running,  Prev: VMS Compilation,  Up: VMS Installation
  399. Installing `gawk' on VMS
  400. ------------------------
  401.    To install `gawk', all you need is a "foreign" command, which is a
  402. `DCL' symbol whose value begins with a dollar sign.
  403.      $ GAWK :== $device:[directory]GAWK
  404. (Substitute the actual location of `gawk.exe' for
  405. `device:[directory]'.) The symbol should be placed in the `login.com'
  406. of any user who wishes to run `gawk', so that it will be defined every
  407. time the user logs on.  Alternatively, the symbol may be placed in the
  408. system-wide `sylogin.com' procedure, which will allow all users to run
  409. `gawk'.
  410.    Optionally, the help entry can be loaded into a VMS help library:
  411.      $ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP
  412. (You may want to substitute a site-specific help library rather than
  413. the standard VMS library `HELPLIB'.)  After loading the help text,
  414.      $ HELP GAWK
  415. will provide information about both the `gawk' implementation and the
  416. `awk' programming language.
  417.    The logical name `AWK_LIBRARY' can designate a default location for
  418. `awk' program files.  For the `-f' option, if the specified filename
  419. has no device or directory path information in it, `gawk' will look in
  420. the current directory first, then in the directory specified by the
  421. translation of `AWK_LIBRARY' if the file was not found.  If after
  422. searching in both directories, the file still is not found, then `gawk'
  423. appends the suffix `.awk' to the filename and the file search will be
  424. re-tried.  If `AWK_LIBRARY' is not defined, that portion of the file
  425. search will fail benignly.
  426. File: gawk.info,  Node: VMS Running,  Next: VMS POSIX,  Prev: VMS Installation Details,  Up: VMS Installation
  427. Running `gawk' on VMS
  428. ---------------------
  429.    Command line parsing and quoting conventions are significantly
  430. different on VMS, so examples in this manual or from other sources
  431. often need minor changes.  They *are* minor though, and all `awk'
  432. programs should run correctly.
  433.    Here are a couple of trivial tests:
  434.      $ gawk -- "BEGIN {print ""Hello, World!""}"
  435.      $ gawk -"W" version     ! could also be -"W version" or "-W version"
  436. Note that upper-case and mixed-case text must be quoted.
  437.    The VMS port of `gawk' includes a `DCL'-style interface in addition
  438. to the original shell-style interface (see the help entry for details).
  439. One side-effect of dual command line parsing is that if there is only a
  440. single parameter (as in the quoted string program above), the command
  441. becomes ambiguous.  To work around this, the normally optional `--'
  442. flag is required to force Unix style rather than `DCL' parsing.  If any
  443. other dash-type options (or multiple parameters such as data files to be
  444. processed) are present, there is no ambiguity and `--' can be omitted.
  445.    The default search path when looking for `awk' program files
  446. specified by the `-f' option is `"SYS$DISK:[],AWK_LIBRARY:"'.  The
  447. logical name `AWKPATH' can be used to override this default.  The format
  448. of `AWKPATH' is a comma-separated list of directory specifications.
  449. When defining it, the value should be quoted so that it retains a single
  450. translation, and not a multi-translation `RMS' searchlist.
  451. File: gawk.info,  Node: VMS POSIX,  Prev: VMS Running,  Up: VMS Installation
  452. Building and using `gawk' under VMS POSIX
  453. -----------------------------------------
  454.    Ignore the instructions above, although `vms/gawk.hlp' should still
  455. be made available in a help library.  Make sure that the two scripts,
  456. `configure' and `mungeconf', are executable; use `chmod +x' on them if
  457. necessary.  Then execute the following commands:
  458.      $ POSIX
  459.      psx> configure vms-posix
  460.      psx> make awktab.c gawk
  461. The first command will construct files `config.h' and `Makefile' out of
  462. templates.  The second command will compile and link `gawk'.  Due to a
  463. `make' bug in VMS POSIX V1.0 and V1.1, the file `awktab.c' must be
  464. given as an explicit target or it will not be built and the final link
  465. step will fail.  Ignore the warning `"Could not find lib m in lib
  466. list"'; it is harmless, caused by the explicit use of `-lm' as a linker
  467. option which is not needed under VMS POSIX.  Under V1.1 (but not V1.0)
  468. a problem with the `yacc' skeleton `/etc/yyparse.c' will cause a
  469. compiler warning for `awktab.c', followed by a linker warning about
  470. compilation warnings in the resulting object module.  These warnings
  471. can be ignored.
  472.    Once built, `gawk' will work like any other shell utility.  Unlike
  473. the normal VMS port of `gawk', no special command line manipulation is
  474. needed in the VMS POSIX environment.
  475. File: gawk.info,  Node: MS-DOS Installation,  Next: Atari Installation,  Prev: VMS Installation,  Up: Installation
  476. Installing `gawk' on MS-DOS
  477. ===========================
  478.    The first step is to get all the files in the `gawk' distribution
  479. onto your PC.  Move all the files from the `pc' directory into the main
  480. directory where the other files are.  Edit the file `make.bat' so that
  481. it will be an acceptable MS-DOS batch file.  This means making sure
  482. that all lines are terminated with the ASCII carriage return and line
  483. feed characters.  restrictions.
  484.    `gawk' has only been compiled with version 5.1 of the Microsoft C
  485. compiler.  The file `make.bat' from the `pc' directory assumes that you
  486. have this compiler.
  487.    Copy the file `setargv.obj' from the library directory where it
  488. resides to the `gawk' source code directory.
  489.    Run `make.bat'.  This will compile `gawk' for you, and link it.
  490. That's all there is to it!
  491. File: gawk.info,  Node: Atari Installation,  Prev: MS-DOS Installation,  Up: Installation
  492. Installing `gawk' on the Atari ST
  493. =================================
  494.    This section assumes that you are running TOS.  It applies to other
  495. Atari models (STe, TT) as well.
  496.    In order to use `gawk', you need to have a shell, either text or
  497. graphics, that does not map all the characters of a command line to
  498. upper case.  Maintaining case distinction in option flags is very
  499. important (*note Invoking `awk': Command Line.).  Popular shells like
  500. `gulam' or `gemini' will work, as will newer versions of `desktop'.
  501. Support for I/O redirection is necessary to make it easy to import
  502. `awk' programs from other environments.  Pipes are nice to have, but
  503. not vital.
  504.    If you have received an executable version of `gawk', place it, as
  505. usual, anywhere in your `PATH' where your shell will find it.
  506.    While executing, `gawk' creates a number of temporary files.  `gawk'
  507. looks for either of the environment variables `TEMP' or `TMPDIR', in
  508. that order.  If either one is found, its value is assumed to be a
  509. directory for temporary files.  This directory must exist, and if you
  510. can spare the memory, it is a good idea to put it on a RAM drive.  If
  511. neither `TEMP' nor `TMPDIR' are found, then `gawk' uses the current
  512. directory for its temporary files.
  513.    The ST version of `gawk' searches for its program files as described
  514. in *Note The `AWKPATH' Environment Variable: AWKPATH Variable.  On the
  515. ST, the default value for the `AWKPATH' variable is
  516. `".,c:\lib\awk,c:\gnu\lib\awk"'.  The search path can be modified by
  517. explicitly setting `AWKPATH' to whatever you wish.  Note that colons
  518. cannot be used on the ST to separate elements in the `AWKPATH'
  519. variable, since they have another, reserved, meaning.  Instead, you
  520. must use a comma to separate elements in the path.  If you are
  521. recompiling `gawk' on the ST, then you can choose a new default search
  522. path, by setting the value of `DEFPATH' in the file `...\config\atari'.
  523. You may choose a different separator character by setting the value of
  524. `ENVSEP' in the same file.  The new values will be used when creating
  525. the header file `config.h'.
  526.    Although `awk' allows great flexibility in doing I/O redirections
  527. from within a program, this facility should be used with care on the ST.
  528. In some circumstances the OS routines for file handle pool processing
  529. lose track of certain events, causing the computer to crash, and
  530. requiring a reboot.  Often a warm reboot is sufficient.  Fortunately,
  531. this happens infrequently, and in rather esoteric situations.  In
  532. particular, avoid having one part of an `awk' program using `print'
  533. statements explicitly redirected to `"/dev/stdout"', while other
  534. `print' statements use the default standard output, and a calling shell
  535. has redirected standard output to a file.
  536.    When `gawk' is compiled with the ST version of `gcc' and its usual
  537. libraries, it will accept both `/' and `\' as path separators.  While
  538. this is convenient, it should be remembered that this removes one,
  539. technically legal, character (`/') from your file names, and that it
  540. may create problems for external programs, called via the `system()'
  541. function, which may not support this convention.  Whenever it is
  542. possible that a file created by `gawk' will be used by some other
  543. program, use only backslashes.  Also remember that in `awk',
  544. backslashes in strings have to be doubled in order to get literal
  545. backslashes.
  546.    The initial port of `gawk' to the ST was done with `gcc'.  If you
  547. wish to recompile `gawk' from scratch, you will need to use a compiler
  548. that accepts ANSI standard C (such as `gcc', Turbo C, or Prospero C).
  549. If `sizeof(int) != sizeof(int *)', the correctness of the generated
  550. code depends heavily on the fact that all function calls have function
  551. prototypes in the current scope.  If your compiler does not accept
  552. function prototypes, you will probably have to add a number of casts to
  553. the code.
  554.    If you are using `gcc', make sure that you have up-to-date libraries.
  555. Older versions have problems with some library functions (`atan2()',
  556. `strftime()', the `%g' conversion in `sprintf()') which may affect the
  557. operation of `gawk'.
  558.    In the `atari' subdirectory of the `gawk' distribution is a version
  559. of the `system()' function that has been tested with `gulam' and `msh';
  560. it should work with other shells as well.  With `gulam', it passes the
  561. string to be executed without spawning an extra copy of a shell.  It is
  562. possible to replace this version of `system()' with a similar function
  563. from a library or from some other source if that version would be a
  564. better choice for the shell you prefer.
  565.    The files needed to recompile `gawk' on the ST can be found in the
  566. `atari' directory.  The provided files and instructions below assume
  567. that you have the GNU C compiler (`gcc'), the `gulam' shell, and an ST
  568. version of `sed'. The `Makefile' is set up to use `byacc' as a `yacc'
  569. replacement.  With a different set of tools some adjustments and/or
  570. editing will be needed.
  571.    `cd' to the `atari' directory.  Copy `Makefile.st' to `makefile' in
  572. the source (parent) directory.  Possibly adjust `../config/atari' to
  573. suit your system.  Execute the script `mkconf.g' which will create the
  574. header file `../config.h'.  Go back to the source directory.  If you
  575. are not using `gcc', check the file `missing.c'.  It may be necessary
  576. to change forward slashes in the references to files from the `atari'
  577. subdirectory into backslashes.  Type `make' and enjoy.
  578.    Compilation with `gcc' of some of the bigger modules, like
  579. `awk_tab.c', may require a full four megabytes of memory.  On smaller
  580. machines you would need to cut down on optimizations, or you would have
  581. to switch to another, less memory hungry, compiler.
  582. File: gawk.info,  Node: Gawk Summary,  Next: Sample Program,  Prev: Installation,  Up: Top
  583. `gawk' Summary
  584. **************
  585.    This appendix provides a brief summary of the `gawk' command line
  586. and the `awk' language.  It is designed to serve as "quick reference."
  587. It is therefore terse, but complete.
  588. * Menu:
  589. * Command Line Summary::        Recapitulation of the command line.
  590. * Language Summary::            A terse review of the language.
  591. * Variables/Fields::            Variables, fields, and arrays.
  592. * Rules Summary::               Patterns and Actions, and their
  593.                                 component parts.
  594. * Functions Summary::           Defining and calling functions.
  595. * Historical Features::         Some undocumented but supported "features".
  596. File: gawk.info,  Node: Command Line Summary,  Next: Language Summary,  Prev: Gawk Summary,  Up: Gawk Summary
  597. Command Line Options Summary
  598. ============================
  599.    The command line consists of options to `gawk' itself, the `awk'
  600. program text (if not supplied via the `-f' option), and values to be
  601. made available in the `ARGC' and `ARGV' predefined `awk' variables:
  602.      awk [POSIX OR GNU STYLE OPTIONS] -f source-file [`--'] FILE ...
  603.      awk [POSIX OR GNU STYLE OPTIONS] [`--'] 'PROGRAM' FILE ...
  604.    The options that `gawk' accepts are:
  605. `-F FS'
  606. `--field-separator=FS'
  607.      Use FS for the input field separator (the value of the `FS'
  608.      predefined variable).
  609. `-f PROGRAM-FILE'
  610. `--file=PROGRAM-FILE'
  611.      Read the `awk' program source from the file PROGRAM-FILE, instead
  612.      of from the first command line argument.
  613. `-v VAR=VAL'
  614. `--assign=VAR=VAL'
  615.      Assign the variable VAR the value VAL before program execution
  616.      begins.
  617. `-W compat'
  618. `--compat'
  619.      Specifies compatibility mode, in which `gawk' extensions are turned
  620.      off.
  621. `-W copyleft'
  622. `-W copyright'
  623. `--copyleft'
  624. `--copyright'
  625.      Print the short version of the General Public License on the error
  626.      output.  This option may disappear in a future version of `gawk'.
  627. `-W help'
  628. `-W usage'
  629. `--help'
  630. `--usage'
  631.      Print a relatively short summary of the available options on the
  632.      error output.
  633. `-W lint'
  634. `--lint'
  635.      Give warnings about dubious or non-portable `awk' constructs.
  636. `-W posix'
  637. `--posix'
  638.      Specifies POSIX compatibility mode, in which `gawk' extensions are
  639.      turned off and additional restrictions apply.
  640. `-W source=PROGRAM-TEXT'
  641. `--source=PROGRAM-TEXT'
  642.      Use PROGRAM-TEXT as `awk' program source code.  This option allows
  643.      mixing command line source code with source code from files, and is
  644.      particularly useful for mixing command line programs with library
  645.      functions.
  646. `-W version'
  647. `--version'
  648.      Print version information for this particular copy of `gawk' on
  649.      the error output.  This option may disappear in a future version
  650.      of `gawk'.
  651.      Signal the end of options.  This is useful to allow further
  652.      arguments to the `awk' program itself to start with a `-'.  This
  653.      is mainly for consistency with the argument parsing conventions of
  654.      POSIX.
  655.    Any other options are flagged as invalid, but are otherwise ignored.
  656. *Note Invoking `awk': Command Line, for more details.
  657. File: gawk.info,  Node: Language Summary,  Next: Variables/Fields,  Prev: Command Line Summary,  Up: Gawk Summary
  658. Language Summary
  659. ================
  660.    An `awk' program consists of a sequence of pattern-action statements
  661. and optional function definitions.
  662.      PATTERN    { ACTION STATEMENTS }
  663.      
  664.      function NAME(PARAMETER LIST)     { ACTION STATEMENTS }
  665.    `gawk' first reads the program source from the PROGRAM-FILE(s) if
  666. specified, or from the first non-option argument on the command line.
  667. The `-f' option may be used multiple times on the command line.  `gawk'
  668. reads the program text from all the PROGRAM-FILE files, effectively
  669. concatenating them in the order they are specified.  This is useful for
  670. building libraries of `awk' functions, without having to include them
  671. in each new `awk' program that uses them.  To use a library function in
  672. a file from a program typed in on the command line, specify `-f
  673. /dev/tty'; then type your program, and end it with a `Control-d'.
  674. *Note Invoking `awk': Command Line.
  675.    The environment variable `AWKPATH' specifies a search path to use
  676. when finding source files named with the `-f' option.  The default
  677. path, which is `.:/local/lib/awk:/gnu/lib/awk' is used if `AWKPATH' is
  678. not set.  If a file name given to the `-f' option contains a `/'
  679. character, no path search is performed.  *Note The `AWKPATH'
  680. Environment Variable: AWKPATH Variable, for a full description of the
  681. `AWKPATH' environment variable.
  682.    `gawk' compiles the program into an internal form, and then proceeds
  683. to read each file named in the `ARGV' array.  If there are no files
  684. named on the command line, `gawk' reads the standard input.
  685.    If a "file" named on the command line has the form `VAR=VAL', it is
  686. treated as a variable assignment: the variable VAR is assigned the
  687. value VAL.  If any of the files have a value that is the null string,
  688. that element in the list is skipped.
  689.    For each line in the input, `gawk' tests to see if it matches any
  690. PATTERN in the `awk' program.  For each pattern that the line matches,
  691. the associated ACTION is executed.
  692. File: gawk.info,  Node: Variables/Fields,  Next: Rules Summary,  Prev: Language Summary,  Up: Gawk Summary
  693. Variables and Fields
  694. ====================
  695.    `awk' variables are dynamic; they come into existence when they are
  696. first used.  Their values are either floating-point numbers or strings.
  697. `awk' also has one-dimension arrays; multiple-dimensional arrays may be
  698. simulated.  There are several predefined variables that `awk' sets as a
  699. program runs; these are summarized below.
  700. * Menu:
  701. * Fields Summary::              Input field splitting.
  702. * Built-in Summary::            `awk''s built-in variables.
  703. * Arrays Summary::              Using arrays.
  704. * Data Type Summary::           Values in `awk' are numbers or strings.
  705. File: gawk.info,  Node: Fields Summary,  Next: Built-in Summary,  Prev: Variables/Fields,  Up: Variables/Fields
  706. Fields
  707. ------
  708.    As each input line is read, `gawk' splits the line into FIELDS,
  709. using the value of the `FS' variable as the field separator.  If `FS'
  710. is a single character, fields are separated by that character.
  711. Otherwise, `FS' is expected to be a full regular expression.  In the
  712. special case that `FS' is a single blank, fields are separated by runs
  713. of blanks and/or tabs.  Note that the value of `IGNORECASE' (*note
  714. Case-sensitivity in Matching: Case-sensitivity.) also affects how
  715. fields are split when `FS' is a regular expression.
  716.    Each field in the input line may be referenced by its position, `$1',
  717. `$2', and so on.  `$0' is the whole line.  The value of a field may be
  718. assigned to as well.  Field numbers need not be constants:
  719.      n = 5
  720.      print $n
  721. prints the fifth field in the input line.  The variable `NF' is set to
  722. the total number of fields in the input line.
  723.    References to nonexistent fields (i.e., fields after `$NF') return
  724. the null-string.  However, assigning to a nonexistent field (e.g.,
  725. `$(NF+2) = 5') increases the value of `NF', creates any intervening
  726. fields with the null string as their value, and causes the value of
  727. `$0' to be recomputed, with the fields being separated by the value of
  728. `OFS'.
  729.    *Note Reading Input Files: Reading Files, for a full description of
  730. the way `awk' defines and uses fields.
  731. File: gawk.info,  Node: Built-in Summary,  Next: Arrays Summary,  Prev: Fields Summary,  Up: Variables/Fields
  732. Built-in Variables
  733. ------------------
  734.    `awk''s built-in variables are:
  735. `ARGC'
  736.      The number of command line arguments (not including options or the
  737.      `awk' program itself).
  738. `ARGIND'
  739.      The index in `ARGV' of the current file being processed.  It is
  740.      always true that `FILENAME == ARGV[ARGIND]'.
  741. `ARGV'
  742.      The array of command line arguments.  The array is indexed from 0
  743.      to `ARGC' - 1.  Dynamically changing the contents of `ARGV' can
  744.      control the files used for data.
  745. `CONVFMT'
  746.      The conversion format to use when converting numbers to strings.
  747. `FIELDWIDTHS'
  748.      A space separated list of numbers describing the fixed-width input
  749.      data.
  750. `ENVIRON'
  751.      An array containing the values of the environment variables.  The
  752.      array is indexed by variable name, each element being the value of
  753.      that variable.  Thus, the environment variable `HOME' would be in
  754.      `ENVIRON["HOME"]'.  Its value might be `/u/close'.
  755.      Changing this array does not affect the environment seen by
  756.      programs which `gawk' spawns via redirection or the `system'
  757.      function.  (This may change in a future version of `gawk'.)
  758.      Some operating systems do not have environment variables.  The
  759.      array `ENVIRON' is empty when running on these systems.
  760. `ERRNO'
  761.      The system error message when an error occurs using `getline' or
  762.      `close'.
  763. `FILENAME'
  764.      The name of the current input file.  If no files are specified on
  765.      the command line, the value of `FILENAME' is `-'.
  766. `FNR'
  767.      The input record number in the current input file.
  768.      The input field separator, a blank by default.
  769. `IGNORECASE'
  770.      The case-sensitivity flag for regular expression operations.  If
  771.      `IGNORECASE' has a nonzero value, then pattern matching in rules,
  772.      field splitting with `FS', regular expression matching with `~'
  773.      and `!~', and the `gsub', `index', `match', `split' and `sub'
  774.      predefined functions all ignore case when doing regular expression
  775.      operations.
  776.      The number of fields in the current input record.
  777.      The total number of input records seen so far.
  778. `OFMT'
  779.      The output format for numbers for the `print' statement, `"%.6g"'
  780.      by default.
  781. `OFS'
  782.      The output field separator, a blank by default.
  783. `ORS'
  784.      The output record separator, by default a newline.
  785.      The input record separator, by default a newline.  `RS' is
  786.      exceptional in that only the first character of its string value
  787.      is used for separating records.  If `RS' is set to the null
  788.      string, then records are separated by blank lines.  When `RS' is
  789.      set to the null string, then the newline character always acts as
  790.      a field separator, in addition to whatever value `FS' may have.
  791. `RSTART'
  792.      The index of the first character matched by `match'; 0 if no match.
  793. `RLENGTH'
  794.      The length of the string matched by `match'; -1 if no match.
  795. `SUBSEP'
  796.      The string used to separate multiple subscripts in array elements,
  797.      by default `"\034"'.
  798.    *Note Built-in Variables::, for more information.
  799. File: gawk.info,  Node: Arrays Summary,  Next: Data Type Summary,  Prev: Built-in Summary,  Up: Variables/Fields
  800. Arrays
  801. ------
  802.    Arrays are subscripted with an expression between square brackets
  803. (`[' and `]').  Array subscripts are *always* strings; numbers are
  804. converted to strings as necessary, following the standard conversion
  805. rules (*note Conversion of Strings and Numbers: Conversion.).
  806.    If you use multiple expressions separated by commas inside the square
  807. brackets, then the array subscript is a string consisting of the
  808. concatenation of the individual subscript values, converted to strings,
  809. separated by the subscript separator (the value of `SUBSEP').
  810.    The special operator `in' may be used in an `if' or `while'
  811. statement to see if an array has an index consisting of a particular
  812. value.
  813.      if (val in array)
  814.              print array[val]
  815.    If the array has multiple subscripts, use `(i, j, ...) in array' to
  816. test for existence of an element.
  817.    The `in' construct may also be used in a `for' loop to iterate over
  818. all the elements of an array.  *Note Scanning all Elements of an Array:
  819. Scanning an Array.
  820.    An element may be deleted from an array using the `delete' statement.
  821.    *Note Arrays in `awk': Arrays, for more detailed information.
  822. File: gawk.info,  Node: Data Type Summary,  Prev: Arrays Summary,  Up: Variables/Fields
  823. Data Types
  824. ----------
  825.    The value of an `awk' expression is always either a number or a
  826. string.
  827.    Certain contexts (such as arithmetic operators) require numeric
  828. values.  They convert strings to numbers by interpreting the text of
  829. the string as a numeral.  If the string does not look like a numeral,
  830. it converts to 0.
  831.    Certain contexts (such as concatenation) require string values.
  832. They convert numbers to strings by effectively printing them with
  833. `sprintf'.  *Note Conversion of Strings and Numbers: Conversion, for
  834. the details.
  835.    To force conversion of a string value to a number, simply add 0 to
  836. it.  If the value you start with is already a number, this does not
  837. change it.
  838.    To force conversion of a numeric value to a string, concatenate it
  839. with the null string.
  840.    The `awk' language defines comparisons as being done numerically if
  841. both operands are numeric, or if one is numeric and the other is a
  842. numeric string.  Otherwise one or both operands are converted to
  843. strings and a string comparison is performed.
  844.    Uninitialized variables have the string value `""' (the null, or
  845. empty, string).  In contexts where a number is required, this is
  846. equivalent to 0.
  847.    *Note Variables::, for more information on variable naming and
  848. initialization; *note Conversion of Strings and Numbers: Conversion.,
  849. for more information on how variable values are interpreted.
  850. File: gawk.info,  Node: Rules Summary,  Next: Functions Summary,  Prev: Variables/Fields,  Up: Gawk Summary
  851. Patterns and Actions
  852. ====================
  853. * Menu:
  854. * Pattern Summary::             Quick overview of patterns.
  855. * Regexp Summary::              Quick overview of regular expressions.
  856. * Actions Summary::             Quick overview of actions.
  857.    An `awk' program is mostly composed of rules, each consisting of a
  858. pattern followed by an action.  The action is enclosed in `{' and `}'.
  859. Either the pattern may be missing, or the action may be missing, but,
  860. of course, not both.  If the pattern is missing, the action is executed
  861. for every single line of input.  A missing action is equivalent to this
  862. action,
  863.      { print }
  864. which prints the entire line.
  865.    Comments begin with the `#' character, and continue until the end of
  866. the line.  Blank lines may be used to separate statements.  Normally, a
  867. statement ends with a newline, however, this is not the case for lines
  868. ending in a `,', `{', `?', `:', `&&', or `||'.  Lines ending in `do' or
  869. `else' also have their statements automatically continued on the
  870. following line.  In other cases, a line can be continued by ending it
  871. with a `\', in which case the newline is ignored.
  872.    Multiple statements may be put on one line by separating them with a
  873. `;'.  This applies to both the statements within the action part of a
  874. rule (the usual case), and to the rule statements.
  875.    *Note Comments in `awk' Programs: Comments, for information on
  876. `awk''s commenting convention; *note `awk' Statements versus Lines:
  877. Statements/Lines., for a description of the line continuation mechanism
  878. in `awk'.
  879. File: gawk.info,  Node: Pattern Summary,  Next: Regexp Summary,  Prev: Rules Summary,  Up: Rules Summary
  880. Patterns
  881. --------
  882.    `awk' patterns may be one of the following:
  883.      /REGULAR EXPRESSION/
  884.      RELATIONAL EXPRESSION
  885.      PATTERN && PATTERN
  886.      PATTERN || PATTERN
  887.      PATTERN ? PATTERN : PATTERN
  888.      (PATTERN)
  889.      ! PATTERN
  890.      PATTERN1, PATTERN2
  891.      BEGIN
  892.      END
  893.    `BEGIN' and `END' are two special kinds of patterns that are not
  894. tested against the input.  The action parts of all `BEGIN' rules are
  895. merged as if all the statements had been written in a single `BEGIN'
  896. rule.  They are executed before any of the input is read.  Similarly,
  897. all the `END' rules are merged, and executed when all the input is
  898. exhausted (or when an `exit' statement is executed).  `BEGIN' and `END'
  899. patterns cannot be combined with other patterns in pattern expressions.
  900. `BEGIN' and `END' rules cannot have missing action parts.
  901.    For `/REGULAR-EXPRESSION/' patterns, the associated statement is
  902. executed for each input line that matches the regular expression.
  903. Regular expressions are extensions of those in `egrep', and are
  904. summarized below.
  905.    A RELATIONAL EXPRESSION may use any of the operators defined below in
  906. the section on actions.  These generally test whether certain fields
  907. match certain regular expressions.
  908.    The `&&', `||', and `!' operators are logical "and," logical "or,"
  909. and logical "not," respectively, as in C.  They do short-circuit
  910. evaluation, also as in C, and are used for combining more primitive
  911. pattern expressions.  As in most languages, parentheses may be used to
  912. change the order of evaluation.
  913.    The `?:' operator is like the same operator in C.  If the first
  914. pattern matches, then the second pattern is matched against the input
  915. record; otherwise, the third is matched.  Only one of the second and
  916. third patterns is matched.
  917.    The `PATTERN1, PATTERN2' form of a pattern is called a range
  918. pattern.  It matches all input lines starting with a line that matches
  919. PATTERN1, and continuing until a line that matches PATTERN2, inclusive.
  920. A range pattern cannot be used as an operand to any of the pattern
  921. operators.
  922.    *Note Patterns::, for a full description of the pattern part of `awk'
  923. rules.
  924.