home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gawk-2.15.5-src.lha / GNU / src / amiga / gawk-2.15.5 / gawk.info-6 < prev    next >
Encoding:
GNU Info File  |  1994-06-13  |  47.8 KB  |  1,235 lines

  1. This is Info file gawk.info, produced by Makeinfo-1.55 from the input
  2. file /gnu/src/amiga/gawk-2.15.5/gawk.texi.
  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.    This is Edition 0.15 of `The GAWK Manual',
  8. for the 2.15 version of the GNU implementation
  9. of AWK.
  10.  
  11.    Copyright (C) 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
  12.  
  13.    Permission is granted to make and distribute verbatim copies of this
  14. manual provided the copyright notice and this permission notice are
  15. preserved on all copies.
  16.  
  17.    Permission is granted to copy and distribute modified versions of
  18. this manual under the conditions for verbatim copying, provided that
  19. the entire resulting derived work is distributed under the terms of a
  20. permission notice identical to this one.
  21.  
  22.    Permission is granted to copy and distribute translations of this
  23. manual into another language, under the above conditions for modified
  24. versions, except that this permission notice may be stated in a
  25. translation approved by the Foundation.
  26.  
  27. 
  28. File: gawk.info,  Node: I/O Functions,  Next: Time Functions,  Prev: String Functions,  Up: Built-in
  29.  
  30. Built-in Functions for Input/Output
  31. ===================================
  32.  
  33. `close(FILENAME)'
  34.      Close the file FILENAME, for input or output.  The argument may
  35.      alternatively be a shell command that was used for redirecting to
  36.      or from a pipe; then the pipe is closed.
  37.  
  38.      *Note Closing Input Files and Pipes: Close Input, regarding closing
  39.      input files and pipes.  *Note Closing Output Files and Pipes:
  40.      Close Output, regarding closing output files and pipes.
  41.  
  42. `system(COMMAND)'
  43.      The system function allows the user to execute operating system
  44.      commands and then return to the `awk' program.  The `system'
  45.      function executes the command given by the string COMMAND.  It
  46.      returns, as its value, the status returned by the command that was
  47.      executed.
  48.  
  49.      For example, if the following fragment of code is put in your `awk'
  50.      program:
  51.  
  52.           END {
  53.                system("mail -s 'awk run done' operator < /dev/null")
  54.           }
  55.  
  56.      the system operator will be sent mail when the `awk' program
  57.      finishes processing input and begins its end-of-input processing.
  58.  
  59.      Note that much the same result can be obtained by redirecting
  60.      `print' or `printf' into a pipe.  However, if your `awk' program
  61.      is interactive, `system' is useful for cranking up large
  62.      self-contained programs, such as a shell or an editor.
  63.  
  64.      Some operating systems cannot implement the `system' function.
  65.      `system' causes a fatal error if it is not supported.
  66.  
  67. Controlling Output Buffering with `system'
  68. ------------------------------------------
  69.  
  70.    Many utility programs will "buffer" their output; they save
  71. information to be written to a disk file or terminal in memory, until
  72. there is enough to be written in one operation.  This is often more
  73. efficient than writing every little bit of information as soon as it is
  74. ready.  However, sometimes it is necessary to force a program to
  75. "flush" its buffers; that is, write the information to its destination,
  76. even if a buffer is not full.  You can do this from your `awk' program
  77. by calling `system' with a null string as its argument:
  78.  
  79.      system("")   # flush output
  80.  
  81. `gawk' treats this use of the `system' function as a special case, and
  82. is smart enough not to run a shell (or other command interpreter) with
  83. the empty command.  Therefore, with `gawk', this idiom is not only
  84. useful, it is efficient.  While this idiom should work with other `awk'
  85. implementations, it will not necessarily avoid starting an unnecessary
  86. shell.
  87.  
  88. 
  89. File: gawk.info,  Node: Time Functions,  Prev: I/O Functions,  Up: Built-in
  90.  
  91. Functions for Dealing with Time Stamps
  92. ======================================
  93.  
  94.    A common use for `awk' programs is the processing of log files.  Log
  95. files often contain time stamp information, indicating when a
  96. particular log record was written.  Many programs log their time stamp
  97. in the form returned by the `time' system call, which is the number of
  98. seconds since a particular epoch.  On POSIX systems, it is the number
  99. of seconds since Midnight, January 1, 1970, UTC.
  100.  
  101.    In order to make it easier to process such log files, and to easily
  102. produce useful reports, `gawk' provides two functions for working with
  103. time stamps.  Both of these are `gawk' extensions; they are not
  104. specified in the POSIX standard, nor are they in any other known version
  105. of `awk'.
  106.  
  107. `systime()'
  108.      This function returns the current time as the number of seconds
  109.      since the system epoch.  On POSIX systems, this is the number of
  110.      seconds since Midnight, January 1, 1970, UTC.  It may be a
  111.      different number on other systems.
  112.  
  113. `strftime(FORMAT, TIMESTAMP)'
  114.      This function returns a string.  It is similar to the function of
  115.      the same name in the ANSI C standard library.  The time specified
  116.      by TIMESTAMP is used to produce a string, based on the contents of
  117.      the FORMAT string.
  118.  
  119.    The `systime' function allows you to compare a time stamp from a log
  120. file with the current time of day.  In particular, it is easy to
  121. determine how long ago a particular record was logged.  It also allows
  122. you to produce log records using the "seconds since the epoch" format.
  123.  
  124.    The `strftime' function allows you to easily turn a time stamp into
  125. human-readable information.  It is similar in nature to the `sprintf'
  126. function, copying non-format specification characters verbatim to the
  127. returned string, and substituting date and time values for format
  128. specifications in the FORMAT string.  If no TIMESTAMP argument is
  129. supplied, `gawk' will use the current time of day as the time stamp.
  130.  
  131.    `strftime' is guaranteed by the ANSI C standard to support the
  132. following date format specifications:
  133.  
  134. `%a'
  135.      The locale's abbreviated weekday name.
  136.  
  137. `%A'
  138.      The locale's full weekday name.
  139.  
  140. `%b'
  141.      The locale's abbreviated month name.
  142.  
  143. `%B'
  144.      The locale's full month name.
  145.  
  146. `%c'
  147.      The locale's "appropriate" date and time representation.
  148.  
  149. `%d'
  150.      The day of the month as a decimal number (01-31).
  151.  
  152. `%H'
  153.      The hour (24-hour clock) as a decimal number (00-23).
  154.  
  155. `%I'
  156.      The hour (12-hour clock) as a decimal number (01-12).
  157.  
  158. `%j'
  159.      The day of the year as a decimal number (001-366).
  160.  
  161. `%m'
  162.      The month as a decimal number (01-12).
  163.  
  164. `%M'
  165.      The minute as a decimal number (00-59).
  166.  
  167. `%p'
  168.      The locale's equivalent of the AM/PM designations associated with
  169.      a 12-hour clock.
  170.  
  171. `%S'
  172.      The second as a decimal number (00-61).  (Occasionally there are
  173.      minutes in a year with one or two leap seconds, which is why the
  174.      seconds can go from 0 all the way to 61.)
  175.  
  176. `%U'
  177.      The week number of the year (the first Sunday as the first day of
  178.      week 1) as a decimal number (00-53).
  179.  
  180. `%w'
  181.      The weekday as a decimal number (0-6).  Sunday is day 0.
  182.  
  183. `%W'
  184.      The week number of the year (the first Monday as the first day of
  185.      week 1) as a decimal number (00-53).
  186.  
  187. `%x'
  188.      The locale's "appropriate" date representation.
  189.  
  190. `%X'
  191.      The locale's "appropriate" time representation.
  192.  
  193. `%y'
  194.      The year without century as a decimal number (00-99).
  195.  
  196. `%Y'
  197.      The year with century as a decimal number.
  198.  
  199. `%Z'
  200.      The time zone name or abbreviation, or no characters if no time
  201.      zone is determinable.
  202.  
  203. `%%'
  204.      A literal `%'.
  205.  
  206.    If a conversion specifier is not one of the above, the behavior is
  207. undefined.  (This is because the ANSI standard for C leaves the
  208. behavior of the C version of `strftime' undefined, and `gawk' will use
  209. the system's version of `strftime' if it's there.  Typically, the
  210. conversion specifier will either not appear in the returned string, or
  211. it will appear literally.)
  212.  
  213.    Informally, a "locale" is the geographic place in which a program is
  214. meant to run.  For example, a common way to abbreviate the date
  215. September 4, 1991 in the United States would be "9/4/91".  In many
  216. countries in Europe, however, it would be abbreviated "4.9.91".  Thus,
  217. the `%x' specification in a `"US"' locale might produce `9/4/91', while
  218. in a `"EUROPE"' locale, it might produce `4.9.91'.  The ANSI C standard
  219. defines a default `"C"' locale, which is an environment that is typical
  220. of what most C programmers are used to.
  221.  
  222.    A public-domain C version of `strftime' is shipped with `gawk' for
  223. systems that are not yet fully ANSI-compliant.  If that version is used
  224. to compile `gawk' (*note Installing `gawk': Installation.), then the
  225. following additional format specifications are available:
  226.  
  227. `%D'
  228.      Equivalent to specifying `%m/%d/%y'.
  229.  
  230. `%e'
  231.      The day of the month, padded with a blank if it is only one digit.
  232.  
  233. `%h'
  234.      Equivalent to `%b', above.
  235.  
  236. `%n'
  237.      A newline character (ASCII LF).
  238.  
  239. `%r'
  240.      Equivalent to specifying `%I:%M:%S %p'.
  241.  
  242. `%R'
  243.      Equivalent to specifying `%H:%M'.
  244.  
  245. `%T'
  246.      Equivalent to specifying `%H:%M:%S'.
  247.  
  248. `%t'
  249.      A TAB character.
  250.  
  251. `%k'
  252.      is replaced by the hour (24-hour clock) as a decimal number (0-23).
  253.      Single digit numbers are padded with a blank.
  254.  
  255. `%l'
  256.      is replaced by the hour (12-hour clock) as a decimal number (1-12).
  257.      Single digit numbers are padded with a blank.
  258.  
  259. `%C'
  260.      The century, as a number between 00 and 99.
  261.  
  262. `%u'
  263.      is replaced by the weekday as a decimal number [1 (Monday)-7].
  264.  
  265. `%V'
  266.      is replaced by the week number of the year (the first Monday as
  267.      the first day of week 1) as a decimal number (01-53).  The method
  268.      for determining the week number is as specified by ISO 8601 (to
  269.      wit: if the week containing January 1 has four or more days in the
  270.      new year, then it is week 1, otherwise it is week 53 of the
  271.      previous year and the next week is week 1).
  272.  
  273. `%Ec %EC %Ex %Ey %EY %Od %Oe %OH %OI'
  274. `%Om %OM %OS %Ou %OU %OV %Ow %OW %Oy'
  275.      These are "alternate representations" for the specifications that
  276.      use only the second letter (`%c', `%C', and so on).  They are
  277.      recognized, but their normal representations are used.  (These
  278.      facilitate compliance with the POSIX `date' utility.)
  279.  
  280. `%v'
  281.      The date in VMS format (e.g. 20-JUN-1991).
  282.  
  283.    Here are two examples that use `strftime'.  The first is an `awk'
  284. version of the C `ctime' function.  (This is a user defined function,
  285. which we have not discussed yet.  *Note User-defined Functions:
  286. User-defined, for more information.)
  287.  
  288.      # ctime.awk
  289.      #
  290.      # awk version of C ctime(3) function
  291.      
  292.      function ctime(ts,    format)
  293.      {
  294.          format = "%a %b %e %H:%M:%S %Z %Y"
  295.          if (ts == 0)
  296.              ts = systime()         # use current time as default
  297.          return strftime(format, ts)
  298.      }
  299.  
  300.    This next example is an `awk' implementation of the POSIX `date'
  301. utility.  Normally, the `date' utility prints the current date and time
  302. of day in a well known format.  However, if you provide an argument to
  303. it that begins with a `+', `date' will copy non-format specifier
  304. characters to the standard output, and will interpret the current time
  305. according to the format specifiers in the string.  For example:
  306.  
  307.      date '+Today is %A, %B %d, %Y.'
  308.  
  309. might print
  310.  
  311.      Today is Thursday, July 11, 1991.
  312.  
  313.    Here is the `awk' version of the `date' utility.
  314.  
  315.      #! /bin/gawk -f
  316.      #
  317.      # date --- implement the P1003.2 Draft 11 'date' command
  318.      #
  319.      # Bug: does not recognize the -u argument.
  320.      
  321.      BEGIN    \
  322.      {
  323.          format = "%a %b %e %H:%M:%S %Z %Y"
  324.          exitval = 0
  325.      
  326.          if (ARGC > 2)
  327.              exitval = 1
  328.          else if (ARGC == 2) {
  329.              format = ARGV[1]
  330.              if (format ~ /^\+/)
  331.                  format = substr(format, 2)    # remove leading +
  332.          }
  333.          print strftime(format)
  334.          exit exitval
  335.      }
  336.  
  337. 
  338. File: gawk.info,  Node: User-defined,  Next: Built-in Variables,  Prev: Built-in,  Up: Top
  339.  
  340. User-defined Functions
  341. **********************
  342.  
  343.    Complicated `awk' programs can often be simplified by defining your
  344. own functions.  User-defined functions can be called just like built-in
  345. ones (*note Function Calls::.), but it is up to you to define them--to
  346. tell `awk' what they should do.
  347.  
  348. * Menu:
  349.  
  350. * Definition Syntax::           How to write definitions and what they mean.
  351. * Function Example::            An example function definition and
  352.                                 what it does.
  353. * Function Caveats::            Things to watch out for.
  354. * Return Statement::            Specifying the value a function returns.
  355.  
  356. 
  357. File: gawk.info,  Node: Definition Syntax,  Next: Function Example,  Prev: User-defined,  Up: User-defined
  358.  
  359. Syntax of Function Definitions
  360. ==============================
  361.  
  362.    Definitions of functions can appear anywhere between the rules of the
  363. `awk' program.  Thus, the general form of an `awk' program is extended
  364. to include sequences of rules *and* user-defined function definitions.
  365.  
  366.    The definition of a function named NAME looks like this:
  367.  
  368.      function NAME (PARAMETER-LIST) {
  369.           BODY-OF-FUNCTION
  370.      }
  371.  
  372. NAME is the name of the function to be defined.  A valid function name
  373. is like a valid variable name: a sequence of letters, digits and
  374. underscores, not starting with a digit.  Functions share the same pool
  375. of names as variables and arrays.
  376.  
  377.    PARAMETER-LIST is a list of the function's arguments and local
  378. variable names, separated by commas.  When the function is called, the
  379. argument names are used to hold the argument values given in the call.
  380. The local variables are initialized to the null string.
  381.  
  382.    The BODY-OF-FUNCTION consists of `awk' statements.  It is the most
  383. important part of the definition, because it says what the function
  384. should actually *do*.  The argument names exist to give the body a way
  385. to talk about the arguments; local variables, to give the body places
  386. to keep temporary values.
  387.  
  388.    Argument names are not distinguished syntactically from local
  389. variable names; instead, the number of arguments supplied when the
  390. function is called determines how many argument variables there are.
  391. Thus, if three argument values are given, the first three names in
  392. PARAMETER-LIST are arguments, and the rest are local variables.
  393.  
  394.    It follows that if the number of arguments is not the same in all
  395. calls to the function, some of the names in PARAMETER-LIST may be
  396. arguments on some occasions and local variables on others.  Another way
  397. to think of this is that omitted arguments default to the null string.
  398.  
  399.    Usually when you write a function you know how many names you intend
  400. to use for arguments and how many you intend to use as locals.  By
  401. convention, you should write an extra space between the arguments and
  402. the locals, so other people can follow how your function is supposed to
  403. be used.
  404.  
  405.    During execution of the function body, the arguments and local
  406. variable values hide or "shadow" any variables of the same names used
  407. in the rest of the program.  The shadowed variables are not accessible
  408. in the function definition, because there is no way to name them while
  409. their names have been taken away for the local variables.  All other
  410. variables used in the `awk' program can be referenced or set normally
  411. in the function definition.
  412.  
  413.    The arguments and local variables last only as long as the function
  414. body is executing.  Once the body finishes, the shadowed variables come
  415. back.
  416.  
  417.    The function body can contain expressions which call functions.  They
  418. can even call this function, either directly or by way of another
  419. function.  When this happens, we say the function is "recursive".
  420.  
  421.    There is no need in `awk' to put the definition of a function before
  422. all uses of the function.  This is because `awk' reads the entire
  423. program before starting to execute any of it.
  424.  
  425.    In many `awk' implementations, the keyword `function' may be
  426. abbreviated `func'.  However, POSIX only specifies the use of the
  427. keyword `function'.  This actually has some practical implications.  If
  428. `gawk' is in POSIX-compatibility mode (*note Invoking `awk': Command
  429. Line.), then the following statement will *not* define a function:
  430.  
  431.      func foo() { a = sqrt($1) ; print a }
  432.  
  433. Instead it defines a rule that, for each record, concatenates the value
  434. of the variable `func' with the return value of the function `foo', and
  435. based on the truth value of the result, executes the corresponding
  436. action.  This is probably not what was desired.  (`awk' accepts this
  437. input as syntactically valid, since functions may be used before they
  438. are defined in `awk' programs.)
  439.  
  440. 
  441. File: gawk.info,  Node: Function Example,  Next: Function Caveats,  Prev: Definition Syntax,  Up: User-defined
  442.  
  443. Function Definition Example
  444. ===========================
  445.  
  446.    Here is an example of a user-defined function, called `myprint', that
  447. takes a number and prints it in a specific format.
  448.  
  449.      function myprint(num)
  450.      {
  451.           printf "%6.3g\n", num
  452.      }
  453.  
  454. To illustrate, here is an `awk' rule which uses our `myprint' function:
  455.  
  456.      $3 > 0     { myprint($3) }
  457.  
  458. This program prints, in our special format, all the third fields that
  459. contain a positive number in our input.  Therefore, when given:
  460.  
  461.       1.2   3.4    5.6   7.8
  462.       9.10 11.12 -13.14 15.16
  463.      17.18 19.20  21.22 23.24
  464.  
  465. this program, using our function to format the results, prints:
  466.  
  467.         5.6
  468.        21.2
  469.  
  470.    Here is a rather contrived example of a recursive function.  It
  471. prints a string backwards:
  472.  
  473.      function rev (str, len) {
  474.          if (len == 0) {
  475.              printf "\n"
  476.              return
  477.          }
  478.          printf "%c", substr(str, len, 1)
  479.          rev(str, len - 1)
  480.      }
  481.  
  482. 
  483. File: gawk.info,  Node: Function Caveats,  Next: Return Statement,  Prev: Function Example,  Up: User-defined
  484.  
  485. Calling User-defined Functions
  486. ==============================
  487.  
  488.    "Calling a function" means causing the function to run and do its
  489. job.  A function call is an expression, and its value is the value
  490. returned by the function.
  491.  
  492.    A function call consists of the function name followed by the
  493. arguments in parentheses.  What you write in the call for the arguments
  494. are `awk' expressions; each time the call is executed, these
  495. expressions are evaluated, and the values are the actual arguments.  For
  496. example, here is a call to `foo' with three arguments (the first being
  497. a string concatenation):
  498.  
  499.      foo(x y, "lose", 4 * z)
  500.  
  501.      *Caution:* whitespace characters (spaces and tabs) are not allowed
  502.      between the function name and the open-parenthesis of the argument
  503.      list.  If you write whitespace by mistake, `awk' might think that
  504.      you mean to concatenate a variable with an expression in
  505.      parentheses.  However, it notices that you used a function name
  506.      and not a variable name, and reports an error.
  507.  
  508.    When a function is called, it is given a *copy* of the values of its
  509. arguments.  This is called "call by value".  The caller may use a
  510. variable as the expression for the argument, but the called function
  511. does not know this: it only knows what value the argument had.  For
  512. example, if you write this code:
  513.  
  514.      foo = "bar"
  515.      z = myfunc(foo)
  516.  
  517. then you should not think of the argument to `myfunc' as being "the
  518. variable `foo'."  Instead, think of the argument as the string value,
  519. `"bar"'.
  520.  
  521.    If the function `myfunc' alters the values of its local variables,
  522. this has no effect on any other variables.  In particular, if `myfunc'
  523. does this:
  524.  
  525.      function myfunc (win) {
  526.        print win
  527.        win = "zzz"
  528.        print win
  529.      }
  530.  
  531. to change its first argument variable `win', this *does not* change the
  532. value of `foo' in the caller.  The role of `foo' in calling `myfunc'
  533. ended when its value, `"bar"', was computed.  If `win' also exists
  534. outside of `myfunc', the function body cannot alter this outer value,
  535. because it is shadowed during the execution of `myfunc' and cannot be
  536. seen or changed from there.
  537.  
  538.    However, when arrays are the parameters to functions, they are *not*
  539. copied.  Instead, the array itself is made available for direct
  540. manipulation by the function.  This is usually called "call by
  541. reference".  Changes made to an array parameter inside the body of a
  542. function *are* visible outside that function.  This can be *very*
  543. dangerous if you do not watch what you are doing.  For example:
  544.  
  545.      function changeit (array, ind, nvalue) {
  546.           array[ind] = nvalue
  547.      }
  548.      
  549.      BEGIN {
  550.                 a[1] = 1 ; a[2] = 2 ; a[3] = 3
  551.                 changeit(a, 2, "two")
  552.                 printf "a[1] = %s, a[2] = %s, a[3] = %s\n", a[1], a[2], a[3]
  553.            }
  554.  
  555. prints `a[1] = 1, a[2] = two, a[3] = 3', because calling `changeit'
  556. stores `"two"' in the second element of `a'.
  557.  
  558. 
  559. File: gawk.info,  Node: Return Statement,  Prev: Function Caveats,  Up: User-defined
  560.  
  561. The `return' Statement
  562. ======================
  563.  
  564.    The body of a user-defined function can contain a `return' statement.
  565. This statement returns control to the rest of the `awk' program.  It
  566. can also be used to return a value for use in the rest of the `awk'
  567. program.  It looks like this:
  568.  
  569.      return EXPRESSION
  570.  
  571.    The EXPRESSION part is optional.  If it is omitted, then the returned
  572. value is undefined and, therefore, unpredictable.
  573.  
  574.    A `return' statement with no value expression is assumed at the end
  575. of every function definition.  So if control reaches the end of the
  576. function body, then the function returns an unpredictable value.  `awk'
  577. will not warn you if you use the return value of such a function; you
  578. will simply get unpredictable or unexpected results.
  579.  
  580.    Here is an example of a user-defined function that returns a value
  581. for the largest number among the elements of an array:
  582.  
  583.      function maxelt (vec,   i, ret) {
  584.           for (i in vec) {
  585.                if (ret == "" || vec[i] > ret)
  586.                     ret = vec[i]
  587.           }
  588.           return ret
  589.      }
  590.  
  591. You call `maxelt' with one argument, which is an array name.  The local
  592. variables `i' and `ret' are not intended to be arguments; while there
  593. is nothing to stop you from passing two or three arguments to `maxelt',
  594. the results would be strange.  The extra space before `i' in the
  595. function parameter list is to indicate that `i' and `ret' are not
  596. supposed to be arguments.  This is a convention which you should follow
  597. when you define functions.
  598.  
  599.    Here is a program that uses our `maxelt' function.  It loads an
  600. array, calls `maxelt', and then reports the maximum number in that
  601. array:
  602.  
  603.      awk '
  604.      function maxelt (vec,   i, ret) {
  605.           for (i in vec) {
  606.                if (ret == "" || vec[i] > ret)
  607.                     ret = vec[i]
  608.           }
  609.           return ret
  610.      }
  611.      
  612.      # Load all fields of each record into nums.
  613.      {
  614.                for(i = 1; i <= NF; i++)
  615.                     nums[NR, i] = $i
  616.      }
  617.      
  618.      END {
  619.           print maxelt(nums)
  620.      }'
  621.  
  622.    Given the following input:
  623.  
  624.       1 5 23 8 16
  625.      44 3 5 2 8 26
  626.      256 291 1396 2962 100
  627.      -6 467 998 1101
  628.      99385 11 0 225
  629.  
  630. our program tells us (predictably) that:
  631.  
  632.      99385
  633.  
  634. is the largest number in our array.
  635.  
  636. 
  637. File: gawk.info,  Node: Built-in Variables,  Next: Command Line,  Prev: User-defined,  Up: Top
  638.  
  639. Built-in Variables
  640. ******************
  641.  
  642.    Most `awk' variables are available for you to use for your own
  643. purposes; they never change except when your program assigns values to
  644. them, and never affect anything except when your program examines them.
  645.  
  646.    A few variables have special built-in meanings.  Some of them `awk'
  647. examines automatically, so that they enable you to tell `awk' how to do
  648. certain things.  Others are set automatically by `awk', so that they
  649. carry information from the internal workings of `awk' to your program.
  650.  
  651.    This chapter documents all the built-in variables of `gawk'.  Most
  652. of them are also documented in the chapters where their areas of
  653. activity are described.
  654.  
  655. * Menu:
  656.  
  657. * User-modified::               Built-in variables that you change
  658.                                 to control `awk'.
  659. * Auto-set::                    Built-in variables where `awk'
  660.                                 gives you information.
  661.  
  662. 
  663. File: gawk.info,  Node: User-modified,  Next: Auto-set,  Prev: Built-in Variables,  Up: Built-in Variables
  664.  
  665. Built-in Variables that Control `awk'
  666. =====================================
  667.  
  668.    This is a list of the variables which you can change to control how
  669. `awk' does certain things.
  670.  
  671. `CONVFMT'
  672.      This string is used by `awk' to control conversion of numbers to
  673.      strings (*note Conversion of Strings and Numbers: Conversion.).
  674.      It works by being passed, in effect, as the first argument to the
  675.      `sprintf' function.  Its default value is `"%.6g"'.  `CONVFMT' was
  676.      introduced by the POSIX standard.
  677.  
  678. `FIELDWIDTHS'
  679.      This is a space separated list of columns that tells `gawk' how to
  680.      manage input with fixed, columnar boundaries.  It is an
  681.      experimental feature that is still evolving.  Assigning to
  682.      `FIELDWIDTHS' overrides the use of `FS' for field splitting.
  683.      *Note Reading Fixed-width Data: Constant Size, for more
  684.      information.
  685.  
  686.      If `gawk' is in compatibility mode (*note Invoking `awk': Command
  687.      Line.), then `FIELDWIDTHS' has no special meaning, and field
  688.      splitting operations are done based exclusively on the value of
  689.      `FS'.
  690.  
  691. `FS'
  692.      `FS' is the input field separator (*note Specifying how Fields are
  693.      Separated: Field Separators.).  The value is a single-character
  694.      string or a multi-character regular expression that matches the
  695.      separations between fields in an input record.
  696.  
  697.      The default value is `" "', a string consisting of a single space.
  698.      As a special exception, this value actually means that any
  699.      sequence of spaces and tabs is a single separator.  It also causes
  700.      spaces and tabs at the beginning or end of a line to be ignored.
  701.  
  702.      You can set the value of `FS' on the command line using the `-F'
  703.      option:
  704.  
  705.           awk -F, 'PROGRAM' INPUT-FILES
  706.  
  707.      If `gawk' is using `FIELDWIDTHS' for field-splitting, assigning a
  708.      value to `FS' will cause `gawk' to return to the normal,
  709.      regexp-based, field splitting.
  710.  
  711. `IGNORECASE'
  712.      If `IGNORECASE' is nonzero, then *all* regular expression matching
  713.      is done in a case-independent fashion.  In particular, regexp
  714.      matching with `~' and `!~', and the `gsub' `index', `match',
  715.      `split' and `sub' functions all ignore case when doing their
  716.      particular regexp operations.  *Note:* since field splitting with
  717.      the value of the `FS' variable is also a regular expression
  718.      operation, that too is done with case ignored.  *Note
  719.      Case-sensitivity in Matching: Case-sensitivity.
  720.  
  721.      If `gawk' is in compatibility mode (*note Invoking `awk': Command
  722.      Line.), then `IGNORECASE' has no special meaning, and regexp
  723.      operations are always case-sensitive.
  724.  
  725. `OFMT'
  726.      This string is used by `awk' to control conversion of numbers to
  727.      strings (*note Conversion of Strings and Numbers: Conversion.) for
  728.      printing with the `print' statement.  It works by being passed, in
  729.      effect, as the first argument to the `sprintf' function.  Its
  730.      default value is `"%.6g"'.  Earlier versions of `awk' also used
  731.      `OFMT' to specify the format for converting numbers to strings in
  732.      general expressions; this has been taken over by `CONVFMT'.
  733.  
  734. `OFS'
  735.      This is the output field separator (*note Output Separators::.).
  736.      It is output between the fields output by a `print' statement.  Its
  737.      default value is `" "', a string consisting of a single space.
  738.  
  739. `ORS'
  740.      This is the output record separator.  It is output at the end of
  741.      every `print' statement.  Its default value is a string containing
  742.      a single newline character, which could be written as `"\n"'.
  743.      (*Note Output Separators::.)
  744.  
  745. `RS'
  746.      This is `awk''s input record separator.  Its default value is a
  747.      string containing a single newline character, which means that an
  748.      input record consists of a single line of text.  (*Note How Input
  749.      is Split into Records: Records.)
  750.  
  751. `SUBSEP'
  752.      `SUBSEP' is the subscript separator.  It has the default value of
  753.      `"\034"', and is used to separate the parts of the name of a
  754.      multi-dimensional array.  Thus, if you access `foo[12,3]', it
  755.      really accesses `foo["12\0343"]' (*note Multi-dimensional Arrays:
  756.      Multi-dimensional.).
  757.  
  758. 
  759. File: gawk.info,  Node: Auto-set,  Prev: User-modified,  Up: Built-in Variables
  760.  
  761. Built-in Variables that Convey Information
  762. ==========================================
  763.  
  764.    This is a list of the variables that are set automatically by `awk'
  765. on certain occasions so as to provide information to your program.
  766.  
  767. `ARGC'
  768. `ARGV'
  769.      The command-line arguments available to `awk' programs are stored
  770.      in an array called `ARGV'.  `ARGC' is the number of command-line
  771.      arguments present.  *Note Invoking `awk': Command Line.  `ARGV' is
  772.      indexed from zero to `ARGC - 1'.  For example:
  773.  
  774.           awk 'BEGIN {
  775.                  for (i = 0; i < ARGC; i++)
  776.                      print ARGV[i]
  777.                }' inventory-shipped BBS-list
  778.  
  779.      In this example, `ARGV[0]' contains `"awk"', `ARGV[1]' contains
  780.      `"inventory-shipped"', and `ARGV[2]' contains `"BBS-list"'.  The
  781.      value of `ARGC' is 3, one more than the index of the last element
  782.      in `ARGV' since the elements are numbered from zero.
  783.  
  784.      The names `ARGC' and `ARGV', as well the convention of indexing
  785.      the array from 0 to `ARGC - 1', are derived from the C language's
  786.      method of accessing command line arguments.
  787.  
  788.      Notice that the `awk' program is not entered in `ARGV'.  The other
  789.      special command line options, with their arguments, are also not
  790.      entered.  But variable assignments on the command line *are*
  791.      treated as arguments, and do show up in the `ARGV' array.
  792.  
  793.      Your program can alter `ARGC' and the elements of `ARGV'.  Each
  794.      time `awk' reaches the end of an input file, it uses the next
  795.      element of `ARGV' as the name of the next input file.  By storing a
  796.      different string there, your program can change which files are
  797.      read.  You can use `"-"' to represent the standard input.  By
  798.      storing additional elements and incrementing `ARGC' you can cause
  799.      additional files to be read.
  800.  
  801.      If you decrease the value of `ARGC', that eliminates input files
  802.      from the end of the list.  By recording the old value of `ARGC'
  803.      elsewhere, your program can treat the eliminated arguments as
  804.      something other than file names.
  805.  
  806.      To eliminate a file from the middle of the list, store the null
  807.      string (`""') into `ARGV' in place of the file's name.  As a
  808.      special feature, `awk' ignores file names that have been replaced
  809.      with the null string.
  810.  
  811. `ARGIND'
  812.      The index in `ARGV' of the current file being processed.  Every
  813.      time `gawk' opens a new data file for processing, it sets `ARGIND'
  814.      to the index in `ARGV' of the file name.  Thus, the condition
  815.      `FILENAME == ARGV[ARGIND]' is always true.
  816.  
  817.      This variable is useful in file processing; it allows you to tell
  818.      how far along you are in the list of data files, and to
  819.      distinguish between multiple successive instances of the same
  820.      filename on the command line.
  821.  
  822.      While you can change the value of `ARGIND' within your `awk'
  823.      program, `gawk' will automatically set it to a new value when the
  824.      next file is opened.
  825.  
  826.      This variable is a `gawk' extension; in other `awk' implementations
  827.      it is not special.
  828.  
  829. `ENVIRON'
  830.      This is an array that contains the values of the environment.  The
  831.      array indices are the environment variable names; the values are
  832.      the values of the particular environment variables.  For example,
  833.      `ENVIRON["HOME"]' might be `/u/close'.  Changing this array does
  834.      not affect the environment passed on to any programs that `awk'
  835.      may spawn via redirection or the `system' function.  (In a future
  836.      version of `gawk', it may do so.)
  837.  
  838.      Some operating systems may not have environment variables.  On
  839.      such systems, the array `ENVIRON' is empty.
  840.  
  841. `ERRNO'
  842.      If a system error occurs either doing a redirection for `getline',
  843.      during a read for `getline', or during a `close' operation, then
  844.      `ERRNO' will contain a string describing the error.
  845.  
  846.      This variable is a `gawk' extension; in other `awk' implementations
  847.      it is not special.
  848.  
  849. `FILENAME'
  850.      This is the name of the file that `awk' is currently reading.  If
  851.      `awk' is reading from the standard input (in other words, there
  852.      are no files listed on the command line), `FILENAME' is set to
  853.      `"-"'.  `FILENAME' is changed each time a new file is read (*note
  854.      Reading Input Files: Reading Files.).
  855.  
  856. `FNR'
  857.      `FNR' is the current record number in the current file.  `FNR' is
  858.      incremented each time a new record is read (*note Explicit Input
  859.      with `getline': Getline.).  It is reinitialized to 0 each time a
  860.      new input file is started.
  861.  
  862. `NF'
  863.      `NF' is the number of fields in the current input record.  `NF' is
  864.      set each time a new record is read, when a new field is created,
  865.      or when `$0' changes (*note Examining Fields: Fields.).
  866.  
  867. `NR'
  868.      This is the number of input records `awk' has processed since the
  869.      beginning of the program's execution.  (*note How Input is Split
  870.      into Records: Records.).  `NR' is set each time a new record is
  871.      read.
  872.  
  873. `RLENGTH'
  874.      `RLENGTH' is the length of the substring matched by the `match'
  875.      function (*note Built-in Functions for String Manipulation: String
  876.      Functions.).  `RLENGTH' is set by invoking the `match' function.
  877.      Its value is the length of the matched string, or -1 if no match
  878.      was found.
  879.  
  880. `RSTART'
  881.      `RSTART' is the start-index in characters of the substring matched
  882.      by the `match' function (*note Built-in Functions for String
  883.      Manipulation: String Functions.).  `RSTART' is set by invoking the
  884.      `match' function.  Its value is the position of the string where
  885.      the matched substring starts, or 0 if no match was found.
  886.  
  887. 
  888. File: gawk.info,  Node: Command Line,  Next: Language History,  Prev: Built-in Variables,  Up: Top
  889.  
  890. Invoking `awk'
  891. **************
  892.  
  893.    There are two ways to run `awk': with an explicit program, or with
  894. one or more program files.  Here are templates for both of them; items
  895. enclosed in `[...]' in these templates are optional.
  896.  
  897.    Besides traditional one-letter POSIX-style options, `gawk' also
  898. supports GNU long named options.
  899.  
  900.      awk [POSIX OR GNU STYLE OPTIONS] -f progfile [`--'] FILE ...
  901.      awk [POSIX OR GNU STYLE OPTIONS] [`--'] 'PROGRAM' FILE ...
  902.  
  903. * Menu:
  904.  
  905. * Options::                     Command line options and their meanings.
  906. * Other Arguments::             Input file names and variable assignments.
  907. * AWKPATH Variable::            Searching directories for `awk' programs.
  908. * Obsolete::                    Obsolete Options and/or features.
  909. * Undocumented::                Undocumented Options and Features.
  910.  
  911. 
  912. File: gawk.info,  Node: Options,  Next: Other Arguments,  Prev: Command Line,  Up: Command Line
  913.  
  914. Command Line Options
  915. ====================
  916.  
  917.    Options begin with a minus sign, and consist of a single character.
  918. GNU style long named options consist of two minus signs and a keyword
  919. that can be abbreviated if the abbreviation allows the option to be
  920. uniquely identified.  If the option takes an argument, then the keyword
  921. is immediately followed by an equals sign (`=') and the argument's
  922. value.  For brevity, the discussion below only refers to the
  923. traditional short options; however the long and short options are
  924. interchangeable in all contexts.
  925.  
  926.    Each long named option for `gawk' has a corresponding POSIX-style
  927. option.  The options and their meanings are as follows:
  928.  
  929. `-F FS'
  930. `--field-separator=FS'
  931.      Sets the `FS' variable to FS (*note Specifying how Fields are
  932.      Separated: Field Separators.).
  933.  
  934. `-f SOURCE-FILE'
  935. `--file=SOURCE-FILE'
  936.      Indicates that the `awk' program is to be found in SOURCE-FILE
  937.      instead of in the first non-option argument.
  938.  
  939. `-v VAR=VAL'
  940. `--assign=VAR=VAL'
  941.      Sets the variable VAR to the value VAL *before* execution of the
  942.      program begins.  Such variable values are available inside the
  943.      `BEGIN' rule (see below for a fuller explanation).
  944.  
  945.      The `-v' option can only set one variable, but you can use it more
  946.      than once, setting another variable each time, like this:
  947.      `-v foo=1 -v bar=2'.
  948.  
  949. `-W GAWK-OPT'
  950.      Following the POSIX standard, options that are implementation
  951.      specific are supplied as arguments to the `-W' option.  With
  952.      `gawk', these arguments may be separated by commas, or quoted and
  953.      separated by whitespace.  Case is ignored when processing these
  954.      options.  These options also have corresponding GNU style long
  955.      named options.  The following `gawk'-specific options are
  956.      available:
  957.  
  958.     `-W compat'
  959.     `--compat'
  960.           Specifies "compatibility mode", in which the GNU extensions in
  961.           `gawk' are disabled, so that `gawk' behaves just like Unix
  962.           `awk'.  *Note Extensions in `gawk' not in POSIX `awk':
  963.           POSIX/GNU, which summarizes the extensions.  Also see *Note
  964.           Downward Compatibility and Debugging: Compatibility Mode.
  965.  
  966.     `-W copyleft'
  967.     `-W copyright'
  968.     `--copyleft'
  969.     `--copyright'
  970.           Print the short version of the General Public License.  This
  971.           option may disappear in a future version of `gawk'.
  972.  
  973.     `-W help'
  974.     `-W usage'
  975.     `--help'
  976.     `--usage'
  977.           Print a "usage" message summarizing the short and long style
  978.           options that `gawk' accepts, and then exit.
  979.  
  980.     `-W lint'
  981.     `--lint'
  982.           Provide warnings about constructs that are dubious or
  983.           non-portable to other `awk' implementations.  Some warnings
  984.           are issued when `gawk' first reads your program.  Others are
  985.           issued at run-time, as your program executes.
  986.  
  987.     `-W posix'
  988.     `--posix'
  989.           Operate in strict POSIX mode.  This disables all `gawk'
  990.           extensions (just like `-W compat'), and adds the following
  991.           additional restrictions:
  992.  
  993.              * `\x' escape sequences are not recognized (*note Constant
  994.                Expressions: Constants.).
  995.  
  996.              * The synonym `func' for the keyword `function' is not
  997.                recognized (*note Syntax of Function Definitions:
  998.                Definition Syntax.).
  999.  
  1000.              * The operators `**' and `**=' cannot be used in place of
  1001.                `^' and `^=' (*note Arithmetic Operators: Arithmetic
  1002.                Ops., and also *note Assignment Expressions: Assignment
  1003.                Ops.).
  1004.  
  1005.              * Specifying `-Ft' on the command line does not set the
  1006.                value of `FS' to be a single tab character (*note
  1007.                Specifying how Fields are Separated: Field Separators.).
  1008.  
  1009.           Although you can supply both `-W compat' and `-W posix' on the
  1010.           command line, `-W posix' will take precedence.
  1011.  
  1012.     `-W source=PROGRAM-TEXT'
  1013.     `--source=PROGRAM-TEXT'
  1014.           Program source code is taken from the PROGRAM-TEXT.  This
  1015.           option allows you to mix `awk' source code in files with
  1016.           program source code that you would enter on the command line.
  1017.           This is particularly useful when you have library functions
  1018.           that you wish to use from your command line programs (*note
  1019.           The `AWKPATH' Environment Variable: AWKPATH Variable.).
  1020.  
  1021.     `-W version'
  1022.     `--version'
  1023.           Prints version information for this particular copy of `gawk'.
  1024.           This is so you can determine if your copy of `gawk' is up to
  1025.           date with respect to whatever the Free Software Foundation is
  1026.           currently distributing.  This option may disappear in a
  1027.           future version of `gawk'.
  1028.  
  1029. `--'
  1030.      Signals the end of the command line options.  The following
  1031.      arguments are not treated as options even if they begin with `-'.
  1032.      This interpretation of `--' follows the POSIX argument parsing
  1033.      conventions.
  1034.  
  1035.      This is useful if you have file names that start with `-', or in
  1036.      shell scripts, if you have file names that will be specified by
  1037.      the user which could start with `-'.
  1038.  
  1039.    Any other options are flagged as invalid with a warning message, but
  1040. are otherwise ignored.
  1041.  
  1042.    In compatibility mode, as a special case, if the value of FS supplied
  1043. to the `-F' option is `t', then `FS' is set to the tab character
  1044. (`"\t"').  This is only true for `-W compat', and not for `-W posix'
  1045. (*note Specifying how Fields are Separated: Field Separators.).
  1046.  
  1047.    If the `-f' option is *not* used, then the first non-option command
  1048. line argument is expected to be the program text.
  1049.  
  1050.    The `-f' option may be used more than once on the command line.  If
  1051. it is, `awk' reads its program source from all of the named files, as
  1052. if they had been concatenated together into one big file.  This is
  1053. useful for creating libraries of `awk' functions.  Useful functions can
  1054. be written once, and then retrieved from a standard place, instead of
  1055. having to be included into each individual program.  You can still type
  1056. in a program at the terminal and use library functions, by specifying
  1057. `-f /dev/tty'.  `awk' will read a file from the terminal to use as part
  1058. of the `awk' program.  After typing your program, type `Control-d' (the
  1059. end-of-file character) to terminate it.  (You may also use `-f -' to
  1060. read program source from the standard input, but then you will not be
  1061. able to also use the standard input as a source of data.)
  1062.  
  1063.    Because it is clumsy using the standard `awk' mechanisms to mix
  1064. source file and command line `awk' programs, `gawk' provides the
  1065. `--source' option.  This does not require you to pre-empt the standard
  1066. input for your source code, and allows you to easily mix command line
  1067. and library source code (*note The `AWKPATH' Environment Variable:
  1068. AWKPATH Variable.).
  1069.  
  1070.    If no `-f' or `--source' option is specified, then `gawk' will use
  1071. the first non-option command line argument as the text of the program
  1072. source code.
  1073.  
  1074. 
  1075. File: gawk.info,  Node: Other Arguments,  Next: AWKPATH Variable,  Prev: Options,  Up: Command Line
  1076.  
  1077. Other Command Line Arguments
  1078. ============================
  1079.  
  1080.    Any additional arguments on the command line are normally treated as
  1081. input files to be processed in the order specified.  However, an
  1082. argument that has the form `VAR=VALUE', means to assign the value VALUE
  1083. to the variable VAR--it does not specify a file at all.
  1084.  
  1085.    All these arguments are made available to your `awk' program in the
  1086. `ARGV' array (*note Built-in Variables::.).  Command line options and
  1087. the program text (if present) are omitted from the `ARGV' array.  All
  1088. other arguments, including variable assignments, are included.
  1089.  
  1090.    The distinction between file name arguments and variable-assignment
  1091. arguments is made when `awk' is about to open the next input file.  At
  1092. that point in execution, it checks the "file name" to see whether it is
  1093. really a variable assignment; if so, `awk' sets the variable instead of
  1094. reading a file.
  1095.  
  1096.    Therefore, the variables actually receive the specified values after
  1097. all previously specified files have been read.  In particular, the
  1098. values of variables assigned in this fashion are *not* available inside
  1099. a `BEGIN' rule (*note `BEGIN' and `END' Special Patterns: BEGIN/END.),
  1100. since such rules are run before `awk' begins scanning the argument list.
  1101. The values given on the command line are processed for escape sequences
  1102. (*note Constant Expressions: Constants.).
  1103.  
  1104.    In some earlier implementations of `awk', when a variable assignment
  1105. occurred before any file names, the assignment would happen *before*
  1106. the `BEGIN' rule was executed.  Some applications came to depend upon
  1107. this "feature."  When `awk' was changed to be more consistent, the `-v'
  1108. option was added to accommodate applications that depended upon this
  1109. old behavior.
  1110.  
  1111.    The variable assignment feature is most useful for assigning to
  1112. variables such as `RS', `OFS', and `ORS', which control input and
  1113. output formats, before scanning the data files.  It is also useful for
  1114. controlling state if multiple passes are needed over a data file.  For
  1115. example:
  1116.  
  1117.      awk 'pass == 1  { PASS 1 STUFF }
  1118.           pass == 2  { PASS 2 STUFF }' pass=1 datafile pass=2 datafile
  1119.  
  1120.    Given the variable assignment feature, the `-F' option is not
  1121. strictly necessary.  It remains for historical compatibility.
  1122.  
  1123. 
  1124. File: gawk.info,  Node: AWKPATH Variable,  Next: Obsolete,  Prev: Other Arguments,  Up: Command Line
  1125.  
  1126. The `AWKPATH' Environment Variable
  1127. ==================================
  1128.  
  1129.    The previous section described how `awk' program files can be named
  1130. on the command line with the `-f' option.  In some `awk'
  1131. implementations, you must supply a precise path name for each program
  1132. file, unless the file is in the current directory.
  1133.  
  1134.    But in `gawk', if the file name supplied in the `-f' option does not
  1135. contain a `/', then `gawk' searches a list of directories (called the
  1136. "search path"), one by one, looking for a file with the specified name.
  1137.  
  1138.    The search path is actually a string consisting of directory names
  1139. separated by colons.  `gawk' gets its search path from the `AWKPATH'
  1140. environment variable.  If that variable does not exist, `gawk' uses the
  1141. default path, which is `.:/local/lib/awk:/gnu/lib/awk'.  (Programs
  1142. written by system administrators should use an `AWKPATH' variable that
  1143. does not include the current directory, `.'.)
  1144.  
  1145.    The search path feature is particularly useful for building up
  1146. libraries of useful `awk' functions.  The library files can be placed
  1147. in a standard directory that is in the default path, and then specified
  1148. on the command line with a short file name.  Otherwise, the full file
  1149. name would have to be typed for each file.
  1150.  
  1151.    By combining the `--source' and `-f' options, your command line
  1152. `awk' programs can use facilities in `awk' library files.
  1153.  
  1154.    Path searching is not done if `gawk' is in compatibility mode.  This
  1155. is true for both `-W compat' and `-W posix'.  *Note Command Line
  1156. Options: Options.
  1157.  
  1158.    *Note:* if you want files in the current directory to be found, you
  1159. must include the current directory in the path, either by writing `.'
  1160. as an entry in the path, or by writing a null entry in the path.  (A
  1161. null entry is indicated by starting or ending the path with a colon, or
  1162. by placing two colons next to each other (`::').)  If the current
  1163. directory is not included in the path, then files cannot be found in
  1164. the current directory.  This path search mechanism is identical to the
  1165. shell's.
  1166.  
  1167. 
  1168. File: gawk.info,  Node: Obsolete,  Next: Undocumented,  Prev: AWKPATH Variable,  Up: Command Line
  1169.  
  1170. Obsolete Options and/or Features
  1171. ================================
  1172.  
  1173.    This section describes features and/or command line options from the
  1174. previous release of `gawk' that are either not available in the current
  1175. version, or that are still supported but deprecated (meaning that they
  1176. will *not* be in the next release).
  1177.  
  1178.    For version 2.15 of `gawk', the following command line options from
  1179. version 2.11.1 are no longer recognized.
  1180.  
  1181. `-c'
  1182.      Use `-W compat' instead.
  1183.  
  1184. `-V'
  1185.      Use `-W version' instead.
  1186.  
  1187. `-C'
  1188.      Use `-W copyright' instead.
  1189.  
  1190. `-a'
  1191. `-e'
  1192.      These options produce an "unrecognized option" error message but
  1193.      have no effect on the execution of `gawk'.  The POSIX standard now
  1194.      specifies traditional `awk' regular expressions for the `awk'
  1195.      utility.
  1196.  
  1197.    The public-domain version of `strftime' that is distributed with
  1198. `gawk' changed for the 2.14 release.  The `%V' conversion specifier
  1199. that used to generate the date in VMS format was changed to `%v'.  This
  1200. is because the POSIX standard for the `date' utility now specifies a
  1201. `%V' conversion specifier.  *Note Functions for Dealing with Time
  1202. Stamps: Time Functions, for details.
  1203.  
  1204. 
  1205. File: gawk.info,  Node: Undocumented,  Prev: Obsolete,  Up: Command Line
  1206.  
  1207. Undocumented Options and Features
  1208. =================================
  1209.  
  1210.    This section intentionally left blank.
  1211.  
  1212. 
  1213. File: gawk.info,  Node: Language History,  Next: Installation,  Prev: Command Line,  Up: Top
  1214.  
  1215. The Evolution of the `awk' Language
  1216. ***********************************
  1217.  
  1218.    This manual describes the GNU implementation of `awk', which is
  1219. patterned after the POSIX specification.  Many `awk' users are only
  1220. familiar with the original `awk' implementation in Version 7 Unix,
  1221. which is also the basis for the version in Berkeley Unix (through
  1222. 4.3-Reno).  This chapter briefly describes the evolution of the `awk'
  1223. language.
  1224.  
  1225. * Menu:
  1226.  
  1227. * V7/S5R3.1::                   The major changes between V7 and
  1228.                                 System V Release 3.1.
  1229. * S5R4::                        Minor changes between System V
  1230.                                 Releases 3.1 and 4.
  1231. * POSIX::                       New features from the POSIX standard.
  1232. * POSIX/GNU::                   The extensions in `gawk'
  1233.                                 not in POSIX `awk'.
  1234.  
  1235.