home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / unix / gawk_doc.zoo / gawk-info-5 < prev    next >
Encoding:
Text File  |  1989-04-13  |  35.8 KB  |  961 lines

  1. Info file gawk-info, produced by Makeinfo, -*- Text -*- from input
  2. file gawk.texinfo.
  3.  
  4. This file documents `awk', a program that you can use to select
  5. particular records in a file and perform operations upon them.
  6.  
  7. Copyright (C) 1989 Free Software Foundation, Inc.
  8.  
  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.  
  13. Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided that
  15. the entire resulting derived work is distributed under the terms of a
  16. permission notice identical to this one.
  17.  
  18. Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions, except that this permission notice may be stated in a
  21. translation approved by the Foundation.
  22.  
  23.  
  24. 
  25. File: gawk-info,  Node: User-modified,  Next: Auto-set,  Up: Special
  26.  
  27. Special Variables That Control `awk'
  28. ====================================
  29.  
  30. This is a list of the variables which you can change to control how
  31. `awk' does certain things.
  32.  
  33. `FS'
  34.      `FS' is the input field separator (*note Field Separators::.). 
  35.      The value is a regular expression that matches the separations
  36.      between fields in an input record.
  37.  
  38.      The default value is `" "', a string consisting of a single
  39.      space.  As a special exception, this value actually means that
  40.      any sequence of spaces and tabs is a single separator.  It also
  41.      causes spaces and tabs at the beginning or end of a line to be
  42.      ignored.
  43.  
  44.      You can set the value of `FS' on the command line using the `-F'
  45.      option:
  46.  
  47.           awk -F, 'PROGRAM' INPUT-FILES
  48.  
  49. `OFMT'
  50.      This string is used by `awk' to control conversion of numbers to
  51.      strings (*note Conversion::.).  It works by being passed, in
  52.      effect, as the first argument to the `sprintf' function.  Its
  53.      default value is `"%.6g"'.
  54.  
  55. `OFS'
  56.      This is the output field separator (*note Output Separators::.).
  57.      It is output between the fields output by a `print' statement. 
  58.      Its default value is `" "', a string consisting of a single space.
  59.  
  60. `ORS'
  61.      This is the output record separator (*note Output
  62.      Separators::.).  It is output at the end of every `print'
  63.      statement.  Its default value is the newline character, often
  64.      represented in `awk' programs as `\n'.
  65.  
  66. `RS'
  67.      This is `awk''s record separator (*note Records::.).  Its
  68.      default value is a string containing a single newline character,
  69.      which means that an input record consists of a single line of
  70.      text.
  71.  
  72. `SUBSEP'
  73.      `SUBSEP' is a subscript separator (*note Multi-dimensional::.). 
  74.      It has the default value of `"\034"', and is used to separate
  75.      the parts of the name of a multi--dimensional array.  Thus, if
  76.      you access `foo[12,3]', it really accesses `foo["12\0343"]'.
  77.  
  78.  
  79. 
  80. File: gawk-info,  Node: Auto-set,  Prev: User-modified,  Up: Special
  81.  
  82. Special Variables That Convey Information to You
  83. ================================================
  84.  
  85. This is a list of the variables that are set automatically by `awk'
  86. on certain occasions so as to provide information for your program.
  87.  
  88. `ARGC'
  89. `ARGV'
  90.      The command--line arguments available to `awk' are stored in an
  91.      array called `ARGV'.  `ARGC' is the number of command--line
  92.      arguments present.  `ARGV' is indexed from zero to `ARGC' - 1. 
  93.      For example:
  94.  
  95.           awk '{ print ARGV[$1] }' inventory-shipped BBS-list
  96.  
  97.      In this example, `ARGV[0]' contains `"awk"', `ARGV[1]' contains
  98.      `"inventory-shipped"', and `ARGV[2]' contains `"BBS-list"'. 
  99.      `ARGC' is 3, one more than the index of the last element in
  100.      `ARGV' since the elements are numbered from zero.
  101.  
  102.      Notice that the `awk' program is not treated as an argument. 
  103.      The `-f' `FILENAME' option, and the `-F' option, are also not
  104.      treated as arguments for this purpose.
  105.  
  106.      Variable assignments on the command line *are* treated as
  107.      arguments, and do show up in the `ARGV' array.
  108.  
  109.      Your program can alter `ARGC' the elements of `ARGV'.  Each time
  110.      `awk' reaches the end of an input file, it uses the next element
  111.      of `ARGV' as the name of the next input file.  By storing a
  112.      different string there, your program can change which files are
  113.      read.  You can use `-' to represent the standard input.  By
  114.      storing additional elements and incrementing `ARGC' you can
  115.      cause additional files to be read.
  116.  
  117.      If you decrease the value of `ARGC', that eliminates input files
  118.      from the end of the list.  By recording the old value of `ARGC'
  119.      elsewhere, your program can treat the eliminated arguments as
  120.      something other than file names.
  121.  
  122.      To eliminate a file from the middle of the list, store the null
  123.      string (`""') into `ARGV' in place of the file's name.  As a
  124.      special feature, `awk' ignores file names that have been
  125.      replaced with the null string.
  126.  
  127. `ENVIRON'
  128.      This is an array that contains the values of the environment. 
  129.      The array indices are the environment variable names; the values
  130.      are the values of the particular environment variables.  For
  131.      example, `ENVIRON["HOME"]' might be `/u/close'.  Changing this
  132.      array does not affect the environment passed on to any programs
  133.      that `awk' may spawn via redirection or the `system' function. 
  134.      (This may not work under operating systems other than MS-DOS,
  135.      Unix, or GNU.)
  136.  
  137. `FILENAME'
  138.      This is the name of the file that `awk' is currently reading. 
  139.      If `awk' is reading from the standard input (in other words,
  140.      there are no files listed on the command line), `FILENAME' is
  141.      set to `"-"'.  `FILENAME' is changed each time a new file is
  142.      read (*note Reading Files::.).
  143.  
  144. `FNR'
  145.      `FNR' is the current record number in the current file.  `FNR'
  146.      is incremented each time a new record is read (*note Getline::.).
  147.      It is reinitialized to 0 each time a new input file is started.
  148.  
  149. `NF'
  150.      `NF' is the number of fields in the current input record.  `NF'
  151.      is set each time a new record is read, when a new field is
  152.      created, or when $0 changes (*note Fields::.).
  153.  
  154. `NR'
  155.      This is the number of input records `awk' has processed since
  156.      the beginning of the program's execution.  (*note Records::.). 
  157.      `NR' is set each time a new record is read.
  158.  
  159. `RLENGTH'
  160.      `RLENGTH' is the length of the string matched by the `match'
  161.      function (*note String Functions::.).  `RLENGTH' is set by
  162.      invoking the `match' function.  Its value is the length of the
  163.      matched string, or -1 if no match was found.
  164.  
  165. `RSTART'
  166.      `RSTART' is the start of the string matched by the `match'
  167.      function (*note String Functions::.).  `RSTART' is set by
  168.      invoking the `match' function.  Its value is the position of the
  169.      string where the matched string starts, or 0 if no match was
  170.      found.
  171.  
  172.  
  173. 
  174. File: gawk-info,  Node: Sample Program,  Next: Notes,  Prev: Special,  Up: Top
  175.  
  176. Sample Program
  177. **************
  178.  
  179. The following example is a complete `awk' program, which prints the
  180. number of occurrences of each word in its input.  It illustrates the
  181. associative nature of `awk' arrays by using strings as subscripts. 
  182. It also demonstrates the `for X in ARRAY' construction.  Finally, it
  183. shows how `awk' can be used in conjunction with other utility
  184. programs to do a useful task of some complexity with a minimum of
  185. effort.  Some explanations follow the program listing.
  186.  
  187.      awk '
  188.      # Print list of word frequencies
  189.      {
  190.          for (i = 1; i <= NF; i++)
  191.              freq[$i]++
  192.      }
  193.      
  194.      END {
  195.          for (word in freq)
  196.              printf "%s\t%d\n", word, freq[word]
  197.      }'
  198.  
  199. The first thing to notice about this program is that it has two
  200. rules.  The first rule, because it has an empty pattern, is executed
  201. on every line of the input.  It uses `awk''s field--accessing
  202. mechanism (*note Fields::.) to pick out the individual words from the
  203. line, and the special variable `NF' (*note Special::.) to know how
  204. many fields are available.
  205.  
  206. For each input word, an element of the array `freq' is incremented to
  207. reflect that the word has been seen an additional time.
  208.  
  209. The second rule, because it has the pattern `END', is not executed
  210. until the input has been exhausted.  It prints out the contents of
  211. the `freq' table that has been built up inside the first action.
  212.  
  213. Note that this program has several problems that would prevent it
  214. from being useful by itself on real text files:
  215.  
  216.    * Words are detected using the `awk' convention that fields are
  217.      separated by whitespace and that other characters in the input
  218.      (except newlines) don't have any special meaning to `awk'.  This
  219.      means that punctuation characters count as part of words.
  220.  
  221.    * The `awk' language considers upper and lower case characters to
  222.      be distinct.  Therefore, `foo' and `Foo' will not be treated by
  223.      this program as the same word.  This is undesirable since in
  224.      normal text, words are capitalized if they begin sentences, and
  225.      a frequency analyzer should not be sensitive to that.
  226.  
  227.    * The output does not come out in any useful order.  You're more
  228.      likely to be interested in which words occur most frequently, or
  229.      having an alphabetized table of how frequently each word occurs.
  230.  
  231. The way to solve these problems is to use other operating system
  232. utilities to process the input and output of the `awk' script. 
  233. Suppose the script shown above is saved in the file `frequency.awk'. 
  234. Then the shell command:
  235.  
  236.      tr A-Z a-z < file1 | tr -cd 'a-z\012' \
  237.        | awk -f frequency.awk \
  238.        | sort +1 -nr
  239.  
  240. produces a table of the words appearing in `file1' in order of
  241. decreasing frequency.
  242.  
  243. The first `tr' command in this pipeline translates all the upper case
  244. characters in `file1' to lower case.  The second `tr' command deletes
  245. all the characters in the input except lower case characters and
  246. newlines.  The second argument to the second `tr' is quoted to
  247. protect the backslash in it from being interpreted by the shell.  The
  248. `awk' program reads this suitably massaged data and produces a word
  249. frequency table, which is not ordered.
  250.  
  251. The `awk' script's output is now sorted by the `sort' command and
  252. printed on the terminal.  The options given to `sort' in this example
  253. specify to sort by the second field of each input line (skipping one
  254. field), that the sort keys should be treated as numeric quantities
  255. (otherwise `15' would come before `5'), and that the sorting should
  256. be done in descending (reverse) order.
  257.  
  258. See the general operating system documentation for more information
  259. on how to use the `tr' and `sort' commands.
  260.  
  261.  
  262. 
  263. File: gawk-info,  Node: Notes,  Next: Glossary,  Prev: Sample Program,  Up: Top
  264.  
  265. Implementation Notes
  266. ********************
  267.  
  268. This appendix contains information mainly of interest to implementors
  269. and maintainers of `gawk'.  Everything in it applies specifically to
  270. `gawk', and not to other implementations.
  271.  
  272. * Menu:
  273.  
  274. * Extensions::           Things`gawk' does that Unix `awk' does not.
  275.  
  276. * Future Extensions::    Things likely to appear in a future release.
  277.  
  278. * Improvements::         Suggestions for future improvements.
  279.  
  280. * Manual Improvements::  Suggestions for improvements to this manual.
  281.  
  282.  
  283. 
  284. File: gawk-info,  Node: Extensions,  Next: Future Extensions,  Up: Notes
  285.  
  286. GNU Extensions to the AWK Language
  287. ==================================
  288.  
  289. Several new features are in a state of flux.  They are described here
  290. merely to document them somewhat, but they will probably change. We
  291. hope they will be incorporated into other versions of `awk', too.
  292.  
  293. All of these features can be turned off either by compiling `gawk'
  294. with `-DSTRICT', or by invoking `gawk' as `awk'.
  295.  
  296. The `AWKPATH' environment variable
  297.      When opening a file supplied via the `-f' option, if the
  298.      filename does not contain a `/', `gawk' will perform a "path
  299.      search" for the file, similar to that performed by the shell. 
  300.      `gawk' gets its search path from the `AWKPATH' environment
  301.      variable.  If that variable does not exist, it uses the default
  302.      path `".:/usr/lib/awk:/usr/local/lib/awk"'.
  303.  
  304. Case Independent Matching
  305.      Two new operators have been introduced, `~~', and `!~~'.  These
  306.      perform regular expression match and no-match operations that
  307.      are case independent.  In other words, `A' and `a' would both
  308.      match `/a/'.
  309.  
  310. The `-i' option
  311.      This option causes the `~' and `!~' operators to behave like the
  312.      `~~' and `!~~' operators described above.
  313.  
  314. The `-v' option
  315.      This option prints version information for this particular copy
  316.      of `gawk'.  This is so you can determine if your copy of `gawk'
  317.      is up to date with respect to whatever the Free Software
  318.      Foundation is currently distributing.  It may disappear in a
  319.      future version of `gawk'.
  320.  
  321.  
  322. 
  323. File: gawk-info,  Node: Future Extensions,  Next: Improvements,  Prev: Extensions,  Up: Notes
  324.  
  325. Extensions Likely To Appear In A Future Release
  326. ===============================================
  327.  
  328. Here are some more extensions that indicate the directions we are
  329. currently considering for `gawk'.  Like the previous section, this
  330. section is also subject to change.  None of these are implemented yet.
  331.  
  332. The `IGNORECASE' special variable
  333.      If `IGNORECASE' is non--zero, then *all* regular expression
  334.      matching will be done in a case--independent fashion.  The `-i'
  335.      option and the `~~' and `!~~' operators will go away, as this
  336.      mechanism generalizes those facilities.
  337.  
  338. More Escape Sequences
  339.      The ANSI C `\a', and `\x' escape sequences will be recognized. 
  340.      Unix `awk' does not recognize `\v', although `gawk' does.
  341.  
  342. `RS' as a regexp
  343.      The meaning of `RS' will be generalized along the lines of `FS'.
  344.  
  345. Transliteration Functions
  346.      We are planning on adding `toupper' and `tolower' functions
  347.      which will take string arguments, and return strings where the
  348.      case of each letter has been transformed to upper-- or
  349.      lower--case respectively.
  350.  
  351. Access To System File Descriptors
  352.      `gawk' will recognize the special file names `/dev/stdin',
  353.      `/dev/stdout', `/dev/stderr', and `/dev/fd/N' internally.  These
  354.      will allow access to inherited file descriptors from within an
  355.      `awk' program.
  356.  
  357.  
  358. 
  359. File: gawk-info,  Node: Improvements,  Next: Manual Improvements,  Prev: Future Extensions,  Up: Notes
  360.  
  361. Suggestions for Future Improvements
  362. ===================================
  363.  
  364. Here are some projects that would--be `gawk' hackers might like to
  365. take on.  They vary in size from a few days to a few weeks of
  366. programming, depending on which one you choose and how fast a
  367. programmer you are.  Please send any improvements you write to the
  368. maintainers at the GNU project.
  369.  
  370.   1. State machine regexp matcher: At present, `gawk' uses the
  371.      backtracking regular expression matcher from the GNU subroutine
  372.      library.  If a regexp is really going to be used a lot of times,
  373.      it is faster to convert it once to a description of a finite
  374.      state machine, then run a routine simulating that machine every
  375.      time you want to match the regexp.  You could use the matching
  376.      routines used by GNU `egrep'.
  377.  
  378.   2. Compilation of `awk' programs: `gawk' uses a `Bison'
  379.      (YACC--like) parser to convert the script given it into a syntax
  380.      tree; the syntax tree is then executed by a simple recursive
  381.      evaluator.  Both of these steps incur a lot of overhead, since
  382.      parsing can be slow (especially if you also do the previous
  383.      project and convert regular expressions to finite state machines
  384.      at compile time) and the recursive evaluator performs many
  385.      procedure calls to do even the simplest things.
  386.  
  387.      It should be possible for `gawk' to convert the script's parse
  388.      tree into a C program which the user would then compile, using
  389.      the normal C compiler and a special `gawk' library to provide
  390.      all the needed functions (regexps, fields, associative arrays,
  391.      type coercion, and so on).
  392.  
  393.      An easier possibility might be for an intermediate phase of
  394.      `awk' to convert the parse tree into a linear byte code form
  395.      like the one used in GNU Emacs Lisp.  The recursive evaluator
  396.      would then be replaced by a straight line byte code interpreter
  397.      that would be intermediate in speed between running a compiled
  398.      program and doing what `gawk' does now.
  399.  
  400.  
  401. 
  402. File: gawk-info,  Node: Manual Improvements,  Prev: Improvements,  Up: Notes
  403.  
  404. Suggestions For Future Improvements of This Manual
  405. ==================================================
  406.  
  407.   1. An error message section has not been included in this version
  408.      of the manual.  Perhaps some nice beta testers will document
  409.      some of the messages for the future.
  410.  
  411.   2. A summary page has not been included, as the ``man'', or help,
  412.      page that comes with the `gawk' code should suffice.
  413.  
  414.      GNU only supports Info, so this manual itself should contain
  415.      whatever forms of information it would be useful to have on an
  416.      Info summary page.
  417.  
  418.   3. A function and variable index has not been included as we are
  419.      not sure what to put in it.
  420.  
  421.   4. A section summarizing the differences between V7 `awk' and
  422.      System V Release 4 `awk' would be useful for long--time `awk'
  423.      hackers.
  424.  
  425.  
  426. 
  427. File: gawk-info,  Node: Glossary,  Next: Index,  Prev: Notes,  Up: Top
  428.  
  429. Glossary
  430. ********
  431.  
  432. Action
  433.      A series of `awk' statements attached to a rule.  If the rule's
  434.      pattern matches an input record, the `awk' language executes the
  435.      rule's action.  Actions are always enclosed in curly braces.
  436.  
  437. Amazing `awk' assembler
  438.      Henry Spencer at the University of Toronto wrote a retargetable
  439.      assembler completely as `awk' scripts.  It is thousands of lines
  440.      long, including machine descriptions for several 8--bit
  441.      microcomputers.  It is distributed with `gawk' and is a good
  442.      example of a program that would have been better written in
  443.      another language.
  444.  
  445. Assignment
  446.      An `awk' expression that changes the value of some `awk'
  447.      variable or data object.  An object that you can assign to is
  448.      called an "lvalue".
  449.  
  450. Built-in function
  451.      The `awk' language provides built--in functions that perform
  452.      various numerical and string computations.  Examples are `sqrt'
  453.      (for the square root of a number) and `substr' (for a substring
  454.      of a string).
  455.  
  456. C
  457.      The system programming language that most of GNU is written in. 
  458.      The `awk' programming language has C--like syntax, and this
  459.      manual points out similarities between `awk' and C when
  460.      appropriate.
  461.  
  462. Compound statement
  463.      A series of `awk' statements, enclosed in curly braces. 
  464.      Compound statements may be nested.
  465.  
  466. Concatenation
  467.      Concatenating two strings means sticking them together, one
  468.      after another, giving a new string.  For example, the string
  469.      `foo' concatenated with the string `bar' gives the string
  470.      `foobar'.
  471.  
  472. Conditional expression
  473.      A relation that is either true or false, such as `(a < b)'. 
  474.      Conditional expressions are used in `if' and `while' statements,
  475.      and in patterns to select which input records to process.
  476.  
  477. Curly braces
  478.      The characters `{' and `}'.  Curly braces are used in `awk' for
  479.      delimiting actions, compound statements, and function bodies.
  480.  
  481. Data objects
  482.      These are numbers and strings of characters.  Numbers are
  483.      converted into strings and vice versa, as needed.
  484.  
  485. Escape Sequences
  486.      A special sequence of characters used for describing
  487.      non--printable characters, such as `\n' for newline, or `\033'
  488.      for the ASCII ESC (escape) character.
  489.  
  490. Field
  491.      When `awk' reads an input record, it splits the record into
  492.      pieces separated by whitespace (or by a separator regexp which
  493.      you can change by setting the special variable `FS').  Such
  494.      pieces are called fields.
  495.  
  496. Format
  497.      Format strings are used to control the appearance of output in
  498.      the `printf' statement.  Also, data conversions from numbers to
  499.      strings are controlled by the format string contained in the
  500.      special variable `OFMT'.
  501.  
  502. Function
  503.      A specialized group of statements often used to encapsulate
  504.      general or program--specific tasks.  `awk' has a number of
  505.      built--in functions, and also allows you to define your own.
  506.  
  507. `gawk'
  508.      The GNU implementation of `awk'.
  509.  
  510. `awk' language
  511.      The language in which `awk' programs are written.
  512.  
  513. `awk' program
  514.      An `awk' program consists of a series of "patterns" and
  515.      "actions", collectively known as "rules".  For each input record
  516.      given to the program, the program's rules are all processed in
  517.      turn.  `awk' programs may also contain function definitions.
  518.  
  519. `awk' script
  520.      Another name for an `awk' program.
  521.  
  522. Input record
  523.      A single chunk of data read in by `awk'.  Usually, an `awk'
  524.      input record consists of one line of text.
  525.  
  526. Keyword
  527.      In the `awk' language, a keyword is a word that has special
  528.      meaning.  Keywords are reserved and may not be used as variable
  529.      names.
  530.  
  531.      The keywords are: `if', `else', `while', `do...while', `for',
  532.      `for...in', `break', `continue', `delete', `next', `function',
  533.      `func', and `exit'.
  534.  
  535. Lvalue
  536.      An expression that can appear on the left side of an assignment
  537.      operator.  In most languages, lvalues can be variables or array
  538.      elements.  In `awk', a field designator can also be used as an
  539.      lvalue.
  540.  
  541. Number
  542.      A numeric valued data object.  The `gawk' implementation uses
  543.      double precision floating point to represent numbers.
  544.  
  545. Pattern
  546.      Patterns tell `awk' which input records are interesting to which
  547.      rules.
  548.  
  549.      A pattern is an arbitrary conditional expression against which
  550.      input is tested.  If the condition is satisfied, the pattern is
  551.      said to "match" the input record.  A typical pattern might
  552.      compare the input record against a regular expression.
  553.  
  554. Range (of input lines)
  555.      A sequence of consecutive lines from the input file.  A pattern
  556.      can specify ranges of input lines for `awk' to process, or it
  557.      can specify single lines.
  558.  
  559. Recursion
  560.      When a function calls itself, either directly or indirectly.  If
  561.      this isn't clear, refer to the entry for ``recursion''.
  562.  
  563. Redirection
  564.      Redirection means performing input from other than the standard
  565.      input stream, or output to other than the standard output stream.
  566.  
  567.      You can redirect the output of the `print' and `printf'
  568.      statements to a file or a system command, using the `>', `>>',
  569.      and `|' operators.  You can redirect input to the `getline'
  570.      statement using the `<' and `|' operators.
  571.  
  572. Regular Expression
  573.      See ``regexp''.
  574.  
  575. Regexp
  576.      Short for "regular expression".  A regexp is a pattern that
  577.      denotes a set of strings, possibly an infinite set.  For
  578.      example, the regexp `R.*xp' matches any string starting with the
  579.      letter `R' and ending with the letters `xp'.  In `awk', regexps
  580.      are used in patterns and in conditional expressions.
  581.  
  582. Rule
  583.      A segment of an `awk' program, that specifies how to process
  584.      single input records.  A rule consists of a "pattern" and an
  585.      "action".  `awk' reads an input record; then, for each rule, if
  586.      the input record satisfies the rule's pattern, `awk' executes
  587.      the rule's action.  Otherwise, the rule does nothing for that
  588.      input record.
  589.  
  590. Special Variable
  591.      The variables `ARGC', `ARGV', `ENVIRON',  `FILENAME', `FNR',
  592.      `FS', `NF', `NR', `OFMT', `OFS', `ORS', `RLENGTH', `RSTART',
  593.      `RS', `SUBSEP', have special meaning to `awk'.  Changing some of
  594.      them affects `awk''s running environment.
  595.  
  596. Stream Editor
  597.      A program that reads records from an input stream and processes
  598.      them one or more at a time.  This is in contrast with batch
  599.      programs, which may expect to read their input files in entirety
  600.      before starting to do anything, and with interactive programs,
  601.      which require input from the user.
  602.  
  603. String
  604.      A datum consisting of a sequence of characters, such as `I am a
  605.      string'.  Constant strings are written with double--quotes in
  606.      the `awk' language, and may contain "escape sequences".
  607.  
  608. Whitespace
  609.      A sequence of blank or tab characters occurring inside an input
  610.      record or a string.
  611.  
  612.  
  613. 
  614. File: gawk-info,  Node: Index,  Prev: Glossary,  Up: Top
  615.  
  616. Index
  617. *****
  618.  
  619. * Menu:
  620.  
  621. * #!: Executable Scripts.
  622. * -f option: Long.
  623. * `$NF', last field in record: Fields.
  624. * `$' (field operator): Fields.
  625. * `>>': Redirection.
  626. * `>': Redirection.
  627. * `BEGIN', special pattern: BEGIN/END.
  628. * `END', special pattern: BEGIN/END.
  629. * `awk' language: This Manual.
  630. * `awk' program: This Manual.
  631. * `break' statement: Break.
  632. * `close' statement for input: Close Input.
  633. * `close' statement for output: Close Output.
  634. * `continue' statement: Continue.
  635. * `delete' statement: Delete.
  636. * `exit' statement: Exit.
  637. * `for (x in ...)': Scanning an Array.
  638. * `for' statement: For.
  639. * `if' statement: If.
  640. * `next' statement: Next.
  641. * `print $0': Very Simple.
  642. * `printf' statement, format of: Basic Printf.
  643. * `printf', format-control characters: Format-Control.
  644. * `printf', modifiers: Modifiers.
  645. * `print' statement: Print.
  646. * `return' statement: Return Statement.
  647. * `while' statement: While.
  648. * `|': Redirection.
  649. * `BBS-list' file: The Files.
  650. * `inventory-shipped' file: The Files.
  651. * Accessing fields: Fields.
  652. * Acronym: History.
  653. * Action, curly braces: Actions.
  654. * Action, curly braces: Getting Started.
  655. * Action, default: Very Simple.
  656. * Action, definition of: Getting Started.
  657. * Action, general: Actions.
  658. * Action, separating statements: Actions.
  659. * Applications of `awk': When.
  660. * Arguments in function call: Function Calls.
  661. * Arguments, Command Line: Command Line.
  662. * Arithmetic operators: Arithmetic Ops.
  663. * Array assignment: Assigning Elements.
  664. * Array reference: Reference to Elements.
  665. * Arrays: Array Intro.
  666. * Arrays, definition of: Array Intro.
  667. * Arrays, deleting an element: Delete.
  668. * Arrays, determining presence of elements: Reference to Elements.
  669. * Arrays, multi-dimensional subscripts: Multi-dimensional.
  670. * Arrays, special `for' statement: Scanning an Array.
  671. * Assignment operators: Assignment Ops.
  672. * Associative arrays: Array Intro.
  673. * Backslash Continuation: Statements/Lines.
  674. * Basic function of `gawk': Getting Started.
  675. * Body of a loop: While.
  676. * Boolean expressions: Boolean Ops.
  677. * Boolean operators: Boolean Ops.
  678. * Boolean patterns: Boolean.
  679. * Built-in functions, list of: Built-in.
  680. * Built-in variables: Variables.
  681. * Calling a function: Function Calls.
  682. * Case sensitivity and gawk: Read Terminal.
  683. * Changing contents of a field: Changing Fields.
  684. * Changing the record separator: Records.
  685. * Closing files and pipes: Close Output.
  686. * Command Line: Command Line.
  687. * Command line formats: Running gawk.
  688. * Command line, setting `FS' on: Field Separators.
  689. * Comments: Comments.
  690. * Comparison expressions: Comparison Ops.
  691. * Comparison expressions as patterns: Comparison Patterns.
  692. * Compound statements: Actions.
  693. * Computed Regular Expressions: Regexp Usage.
  694. * Concatenation: Concatenation.
  695. * Conditional Patterns: Conditional Patterns.
  696. * Conditional expression: Conditional Exp.
  697. * Constants, types of: Constants.
  698. * Continuing statements on the next line: Statements/Lines.
  699. * Conversion of strings and numbers: Conversion.
  700. * Curly braces: Actions.
  701. * Curly braces: Getting Started.
  702. * Default action: Very Simple.
  703. * Default pattern: Very Simple.
  704. * Deleting elements of arrays: Delete.
  705. * Differences between `gawk' and `awk': Arithmetic Ops.
  706. * Differences between `gawk' and `awk': Constants.
  707. * Documenting `awk' programs: Comments.
  708. * Dynamic Regular Expressions: Regexp Usage.
  709. * Element assignment: Assigning Elements.
  710. * Element of array: Reference to Elements.
  711. * Emacs Lisp: When.
  712. * Empty pattern: Empty.
  713. * Escape sequence notation: Constants.
  714. * Examining fields: Fields.
  715. * Executable Scripts: Executable Scripts.
  716. * Expression, conditional: Conditional Exp.
  717. * Expressions: Actions.
  718. * Expressions, boolean: Boolean Ops.
  719. * Expressions, comparison: Comparison Ops.
  720. * Field separator, `FS': Field Separators.
  721. * Field separator, choice of: Field Separators.
  722. * Field separator, setting on command line: Field Separators.
  723. * Field, changing contents of: Changing Fields.
  724. * Fields: Fields.
  725. * Fields, negative-numbered: Non-Constant Fields.
  726. * Fields, semantics of: Field Separators.
  727. * Fields, separating: Field Separators.
  728. * Format specifier: Format-Control.
  729. * Format string: Basic Printf.
  730. * Formatted output: Printf.
  731. * Function call: Function Calls.
  732. * Function definitions: Actions.
  733. * Functions, user-defined: User-defined.
  734. * General input: Reading Files.
  735. * History of `awk': History.
  736. * How gawk works: Two Rules.
  737. * Increment operators: Increment Ops.
  738. * Input file, sample: The Files.
  739. * Input, `getline' function: Getline.
  740. * Input, general: Reading Files.
  741. * Input, multiple line records: Multiple.
  742. * Input, standard: Read Terminal.
  743. * Input, standard: Reading Files.
  744. * Interaction of `awk' with other programs: I/O Functions.
  745. * Invocation of `gawk': Command Line.
  746. * Language, `awk': This Manual.
  747. * Loop: While.
  748. * Loops, breaking out of: Break.
  749. * Lvalue: Assignment Ops.
  750. * Manual, using this: This Manual.
  751. * Metacharacters: Regexp Operators.
  752. * Mod function, semantics of: Arithmetic Ops.
  753. * Modifiers (in format specifiers): Modifiers.
  754. * Multiple line records: Multiple.
  755. * Multiple passes over data: Command Line.
  756. * Multiple statements on one line: Statements/Lines.
  757. * Negative-numbered fields: Non-Constant Fields.
  758. * Number of fields, `NF': Fields.
  759. * Number of records, `FNR': Records.
  760. * Number of records, `NR': Records.
  761. * Numerical constant: Constants.
  762. * Numerical value: Constants.
  763. * One-liners: One-liners.
  764. * Operator, Ternary: Conditional Patterns.
  765. * Operators, `$': Fields.
  766. * Operators, arithmetic: Arithmetic Ops.
  767. * Operators, assignment: Assignment Ops.
  768. * Operators, boolean: Boolean Ops.
  769. * Operators, increment: Increment Ops.
  770. * Operators, regular expression matching: Regexp Usage.
  771. * Operators, relational: Comparison Ops.
  772. * Operators, relational: Comparison Patterns.
  773. * Operators, string: Concatenation.
  774. * Operators, string-matching: Regexp Usage.
  775. * Options, Command Line: Command Line.
  776. * Output: Printing.
  777. * Output field separator, `OFS': Output Separators.
  778. * Output record separator, `ORS': Output Separators.
  779. * Output redirection: Redirection.
  780. * Output, formatted: Printf.
  781. * Output, piping: Redirection.
  782. * Passes, Multiple: Command Line.
  783. * Pattern, case sensitive: Read Terminal.
  784. * Pattern, comparison expressions: Comparison Patterns.
  785. * Pattern, default: Very Simple.
  786. * Pattern, definition of: Getting Started.
  787. * Pattern, empty: Empty.
  788. * Pattern, regular expressions: Regexp.
  789. * Patterns, `BEGIN': BEGIN/END.
  790. * Patterns, `END': BEGIN/END.
  791. * Patterns, Conditional: Conditional Patterns.
  792. * Patterns, boolean: Boolean.
  793. * Patterns, definition of: Patterns.
  794. * Patterns, types of: Patterns.
  795. * Pipes for output: Redirection.
  796. * Printing, general: Printing.
  797. * Program, `awk': This Manual.
  798. * Program, Self contained: Executable Scripts.
  799. * Program, definition of: Getting Started.
  800. * Programs, documenting: Comments.
  801. * Range pattern: Ranges.
  802. * Reading files, `getline' function: Getline.
  803. * Reading files, general: Reading Files.
  804. * Reading files, multiple line records: Multiple.
  805. * Record separator, `RS': Records.
  806. * Records, multiple line: Multiple.
  807. * Redirection of output: Redirection.
  808. * Reference to array: Reference to Elements.
  809. * Regexp: Regexp.
  810. * Regular Expressions, Computed: Regexp Usage.
  811. * Regular Expressions, Dynamic: Regexp Usage.
  812. * Regular expression matching operators: Regexp Usage.
  813. * Regular expression, metacharacters: Regexp Operators.
  814. * Regular expressions as patterns: Regexp.
  815. * Regular expressions, field separators and: Field Separators.
  816. * Relational operators: Comparison Patterns.
  817. * Relational operators: Comparison Ops.
  818. * Removing elements of arrays: Delete.
  819. * Rule, definition of: Getting Started.
  820. * Running gawk programs: Running gawk.
  821. * Sample input file: The Files.
  822. * Scanning an array: Scanning an Array.
  823. * Script, definition of: Getting Started.
  824. * Scripts, Executable: Executable Scripts.
  825. * Scripts, Shell: Executable Scripts.
  826. * Self contained Programs: Executable Scripts.
  827. * Separator character, choice of: Field Separators.
  828. * Shell Scripts: Executable Scripts.
  829. * Single quotes, why they are needed: One-shot.
  830. * Special variables, user modifiable: User-modified.
  831. * Standard input: Read Terminal.
  832. * Standard input: Reading Files.
  833. * Statements: Statements.
  834. * Statements: Actions.
  835. * String constants: Constants.
  836. * String operators: Concatenation.
  837. * String value: Constants.
  838. * String-matching operators: Regexp Usage.
  839. * Subscripts, multi-dimensional in arrays: Multi-dimensional.
  840. * Ternary Operator: Conditional Patterns.
  841. * Use of comments: Comments.
  842. * User-defined functions: User-defined.
  843. * User-defined variables: Variables.
  844. * Uses of `awk': Preface.
  845. * Using this manual: This Manual.
  846. * Variables, built-in: Variables.
  847. * Variables, user-defined: Variables.
  848. * What is `awk': Preface.
  849. * When to use `awk': When.
  850. * file, `awk' program: Long.
  851. * patterns, range: Ranges.
  852. * program file: Long.
  853. * regexp search operators: Regexp Usage.
  854. * running long programs: Long.
  855.  
  856.  
  857.  
  858. Tag Table:
  859. Node: Top918
  860. Node: Preface2804
  861. Node: History4267
  862. Node: License5644
  863. Node: This Manual18989
  864. Node: The Files20330
  865. Node: Getting Started22914
  866. Node: Very Simple24249
  867. Node: Two Rules26030
  868. Node: More Complex28066
  869. Node: Running gawk30908
  870. Node: One-shot31827
  871. Node: Read Terminal32945
  872. Node: Long33862
  873. Node: Executable Scripts34991
  874. Node: Command Line36534
  875. Node: Comments40168
  876. Node: Statements/Lines41067
  877. Node: When43498
  878. Node: Reading Files45420
  879. Node: Records47119
  880. Node: Fields49902
  881. Node: Non-Constant Fields52789
  882. Node: Changing Fields54591
  883. Node: Field Separators57302
  884. Node: Multiple62004
  885. Node: Assignment Options64393
  886. Node: Getline65608
  887. Node: Close Input74958
  888. Node: Printing76023
  889. Node: Print76748
  890. Node: Print Examples78712
  891. Node: Output Separators80751
  892. Node: Redirection82417
  893. Node: Close Output85886
  894. Node: Printf88132
  895. Node: Basic Printf88908
  896. Node: Format-Control90261
  897. Node: Modifiers91806
  898. Node: Printf Examples93108
  899. Node: One-liners95707
  900. Node: Patterns97642
  901. Node: Empty100130
  902. Node: Regexp100402
  903. Node: Regexp Usage101173
  904. Node: Regexp Operators102947
  905. Node: Comparison Patterns107890
  906. Node: Ranges109336
  907. Node: BEGIN/END110722
  908. Node: Boolean113151
  909. Node: Conditional Patterns115605
  910. Node: Actions116105
  911. Node: Expressions117435
  912. Node: Constants119124
  913. Node: Variables121097
  914. Node: Arithmetic Ops122454
  915. Node: Concatenation123840
  916. Node: Comparison Ops124569
  917. Node: Boolean Ops125973
  918. Node: Assignment Ops128266
  919. Node: Increment Ops131817
  920. Node: Conversion134112
  921. Node: Conditional Exp136066
  922. Node: Function Calls137384
  923. Node: Statements139939
  924. Node: If141253
  925. Node: While142627
  926. Node: Do144232
  927. Node: For145265
  928. Node: Break148306
  929. Node: Continue149848
  930. Node: Next151476
  931. Node: Exit152985
  932. Node: Arrays154514
  933. Node: Array Intro155624
  934. Node: Reference to Elements159227
  935. Node: Assigning Elements161115
  936. Node: Array Example161615
  937. Node: Scanning an Array163336
  938. Node: Delete165642
  939. Node: Multi-dimensional166529
  940. Node: Multi-scanning169746
  941. Node: Built-in171303
  942. Node: Numeric Functions172806
  943. Node: String Functions176601
  944. Node: I/O Functions183717
  945. Node: User-defined185189
  946. Node: Definition Syntax185834
  947. Node: Function Example187928
  948. Node: Function Caveats189034
  949. Node: Return Statement191386
  950. Node: Special193612
  951. Node: User-modified194478
  952. Node: Auto-set196511
  953. Node: Sample Program200558
  954. Node: Notes204316
  955. Node: Extensions204909
  956. Node: Future Extensions206490
  957. Node: Improvements207922
  958. Node: Manual Improvements210034
  959. Node: Glossary210928
  960. Node: Index217934
  961.