home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / gawk.info-1 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  48KB  |  837 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.    This file documents `awk', a program that you can use to select
  4. particular records in a file and perform operations upon them.
  5.    This is Edition 0.15 of `The GAWK Manual',
  6. for the 2.15 version of the GNU implementation
  7. of AWK.
  8.    Copyright (C) 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: gawk.info,  Node: Top,  Next: Preface,  Prev: (dir),  Up: (dir)
  21. General Introduction
  22. ********************
  23.    This file documents `awk', a program that you can use to select
  24. particular records in a file and perform operations upon them.
  25.    This is Edition 0.15 of `The GAWK Manual',
  26. for the 2.15 version of the GNU implementation
  27. of AWK.
  28. * Menu:
  29. * Preface::                     What you can do with `awk'; brief history
  30.                                 and acknowledgements.
  31. * Copying::                     Your right to copy and distribute `gawk'.
  32. * This Manual::                 Using this manual.
  33.                                 Includes sample input files that you can use.
  34. * Getting Started::             A basic introduction to using `awk'.
  35.                                 How to run an `awk' program.
  36.                                 Command line syntax.
  37. * Reading Files::               How to read files and manipulate fields.
  38. * Printing::                    How to print using `awk'.  Describes the
  39.                                 `print' and `printf' statements.
  40.                                 Also describes redirection of output.
  41. * One-liners::                  Short, sample `awk' programs.
  42. * Patterns::                    The various types of patterns
  43.                                 explained in detail.
  44. * Actions::                     The various types of actions are
  45.                                 introduced here.  Describes
  46.                                 expressions and the various operators in
  47.                                 detail.  Also describes comparison expressions.
  48. * Expressions::                 Expressions are the basic building
  49.                                 blocks of statements.
  50. * Statements::                  The various control statements are
  51.                                 described in detail.
  52. * Arrays::                      The description and use of arrays.
  53.                                 Also includes array-oriented control
  54.                                 statements.
  55. * Built-in::                    The built-in functions are summarized here.
  56. * User-defined::                User-defined functions are described in detail.
  57. * Built-in Variables::          Built-in Variables
  58. * Command Line::                How to run `gawk'.
  59. * Language History::            The evolution of the `awk' language.
  60. * Installation::                Installing `gawk' under
  61.                                 various operating systems.
  62. * Gawk Summary::                `gawk' Options and Language Summary.
  63. * Sample Program::              A sample `awk' program with a
  64.                                 complete explanation.
  65. * Bugs::                        Reporting Problems and Bugs.
  66. * Notes::                       Something about the
  67.                                 implementation of `gawk'.
  68. * Glossary::                    An explanation of some unfamiliar terms.
  69. * Index::
  70. File: gawk.info,  Node: Preface,  Next: Copying,  Prev: Top,  Up: Top
  71. Preface
  72. *******
  73.    If you are like many computer users, you would frequently like to
  74. make changes in various text files wherever certain patterns appear, or
  75. extract data from parts of certain lines while discarding the rest.  To
  76. write a program to do this in a language such as C or Pascal is a
  77. time-consuming inconvenience that may take many lines of code.  The job
  78. may be easier with `awk'.
  79.    The `awk' utility interprets a special-purpose programming language
  80. that makes it possible to handle simple data-reformatting jobs easily
  81. with just a few lines of code.
  82.    The GNU implementation of `awk' is called `gawk'; it is fully upward
  83. compatible with the System V Release 4 version of `awk'.  `gawk' is
  84. also upward compatible with the POSIX (draft) specification of the
  85. `awk' language.  This means that all properly written `awk' programs
  86. should work with `gawk'.  Thus, we usually don't distinguish between
  87. `gawk' and other `awk' implementations in this manual.
  88.    This manual teaches you what `awk' does and how you can use `awk'
  89. effectively.  You should already be familiar with basic system commands
  90. such as `ls'.  Using `awk' you can:
  91.    * manage small, personal databases
  92.    * generate reports
  93.    * validate data
  94.    * produce indexes, and perform other document preparation tasks
  95.    * even experiment with algorithms that can be adapted later to other
  96.      computer languages
  97. * Menu:
  98. * History::                     The history of `gawk' and
  99.                                 `awk'.  Acknowledgements.
  100. File: gawk.info,  Node: History,  Prev: Preface,  Up: Preface
  101. History of `awk' and `gawk'
  102. ===========================
  103.    The name `awk' comes from the initials of its designers: Alfred V.
  104. Aho, Peter J. Weinberger, and Brian W. Kernighan.  The original version
  105. of `awk' was written in 1977.  In 1985 a new version made the
  106. programming language more powerful, introducing user-defined functions,
  107. multiple input streams, and computed regular expressions.  This new
  108. version became generally available with System V Release 3.1.  The
  109. version in System V Release 4 added some new features and also cleaned
  110. up the behavior in some of the "dark corners" of the language.  The
  111. specification for `awk' in the POSIX Command Language and Utilities
  112. standard further clarified the language based on feedback from both the
  113. `gawk' designers, and the original `awk' designers.
  114.    The GNU implementation, `gawk', was written in 1986 by Paul Rubin
  115. and Jay Fenlason, with advice from Richard Stallman.  John Woods
  116. contributed parts of the code as well.  In 1988 and 1989, David
  117. Trueman, with help from Arnold Robbins, thoroughly reworked `gawk' for
  118. compatibility with the newer `awk'.  Current development (1992) focuses
  119. on bug fixes, performance improvements, and standards compliance.
  120.    We need to thank many people for their assistance in producing this
  121. manual.  Jay Fenlason contributed many ideas and sample programs.
  122. Richard Mlynarik and Robert J. Chassell gave helpful comments on early
  123. drafts of this manual.  The paper `A Supplemental Document for `awk''
  124. by John W.  Pierce of the Chemistry Department at UC San Diego,
  125. pinpointed several issues relevant both to `awk' implementation and to
  126. this manual, that would otherwise have escaped us.  David Trueman, Pat
  127. Rankin, and Michal Jaegermann also contributed sections of the manual.
  128.    The following people provided many helpful comments on this edition
  129. of the manual: Rick Adams, Michael Brennan, Rich Burridge, Diane Close,
  130. Christopher ("Topher") Eliot, Michael Lijewski, Pat Rankin, Miriam
  131. Robbins, and Michal Jaegermann.  Robert J. Chassell provided much
  132. valuable advice on the use of Texinfo.
  133.    Finally, we would like to thank Brian Kernighan of Bell Labs for
  134. invaluable assistance during the testing and debugging of `gawk', and
  135. for help in clarifying numerous points about the language.
  136. File: gawk.info,  Node: Copying,  Next: This Manual,  Prev: Preface,  Up: Top
  137. GNU GENERAL PUBLIC LICENSE
  138. **************************
  139.                          Version 2, June 1991
  140.      Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  141.      675 Mass Ave, Cambridge, MA 02139, USA
  142.      
  143.      Everyone is