home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
gnu
/
info
/
gawk.info-1
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-02-21
|
48KB
|
837 lines
This is Info file gawk.info, produced by Makeinfo-1.55 from the input
file gawk.texi.
This file documents `awk', a program that you can use to select
particular records in a file and perform operations upon them.
This is Edition 0.15 of `The GAWK Manual',
for the 2.15 version of the GNU implementation
of AWK.
Copyright (C) 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.
File: gawk.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir)
General Introduction
********************
This file documents `awk', a program that you can use to select
particular records in a file and perform operations upon them.
This is Edition 0.15 of `The GAWK Manual',
for the 2.15 version of the GNU implementation
of AWK.
* Menu:
* Preface:: What you can do with `awk'; brief history
and acknowledgements.
* Copying:: Your right to copy and distribute `gawk'.
* This Manual:: Using this manual.
Includes sample input files that you can use.
* Getting Started:: A basic introduction to using `awk'.
How to run an `awk' program.
Command line syntax.
* Reading Files:: How to read files and manipulate fields.
* Printing:: How to print using `awk'. Describes the
`print' and `printf' statements.
Also describes redirection of output.
* One-liners:: Short, sample `awk' programs.
* Patterns:: The various types of patterns
explained in detail.
* Actions:: The various types of actions are
introduced here. Describes
expressions and the various operators in
detail. Also describes comparison expressions.
* Expressions:: Expressions are the basic building
blocks of statements.
* Statements:: The various control statements are
described in detail.
* Arrays:: The description and use of arrays.
Also includes array-oriented control
statements.
* Built-in:: The built-in functions are summarized here.
* User-defined:: User-defined functions are described in detail.
* Built-in Variables:: Built-in Variables
* Command Line:: How to run `gawk'.
* Language History:: The evolution of the `awk' language.
* Installation:: Installing `gawk' under
various operating systems.
* Gawk Summary:: `gawk' Options and Language Summary.
* Sample Program:: A sample `awk' program with a
complete explanation.
* Bugs:: Reporting Problems and Bugs.
* Notes:: Something about the
implementation of `gawk'.
* Glossary:: An explanation of some unfamiliar terms.
* Index::
File: gawk.info, Node: Preface, Next: Copying, Prev: Top, Up: Top
Preface
*******
If you are like many computer users, you would frequently like to
make changes in various text files wherever certain patterns appear, or
extract data from parts of certain lines while discarding the rest. To
write a program to do this in a language such as C or Pascal is a
time-consuming inconvenience that may take many lines of code. The job
may be easier with `awk'.
The `awk' utility interprets a special-purpose programming language
that makes it possible to handle simple data-reformatting jobs easily
with just a few lines of code.
The GNU implementation of `awk' is called `gawk'; it is fully upward
compatible with the System V Release 4 version of `awk'. `gawk' is
also upward compatible with the POSIX (draft) specification of the
`awk' language. This means that all properly written `awk' programs
should work with `gawk'. Thus, we usually don't distinguish between
`gawk' and other `awk' implementations in this manual.
This manual teaches you what `awk' does and how you can use `awk'
effectively. You should already be familiar with basic system commands
such as `ls'. Using `awk' you can:
* manage small, personal databases
* generate reports
* validate data
* produce indexes, and perform other document preparation tasks
* even experiment with algorithms that can be adapted later to other
computer languages
* Menu:
* History:: The history of `gawk' and
`awk'. Acknowledgements.
File: gawk.info, Node: History, Prev: Preface, Up: Preface
History of `awk' and `gawk'
===========================
The name `awk' comes from the initials of its designers: Alfred V.
Aho, Peter J. Weinberger, and Brian W. Kernighan. The original version
of `awk' was written in 1977. In 1985 a new version made the
programming language more powerful, introducing user-defined functions,
multiple input streams, and computed regular expressions. This new
version became generally available with System V Release 3.1. The
version in System V Release 4 added some new features and also cleaned
up the behavior in some of the "dark corners" of the language. The
specification for `awk' in the POSIX Command Language and Utilities
standard further clarified the language based on feedback from both the
`gawk' designers, and the original `awk' designers.
The GNU implementation, `gawk', was written in 1986 by Paul Rubin
and Jay Fenlason, with advice from Richard Stallman. John Woods
contributed parts of the code as well. In 1988 and 1989, David
Trueman, with help from Arnold Robbins, thoroughly reworked `gawk' for
compatibility with the newer `awk'. Current development (1992) focuses
on bug fixes, performance improvements, and standards compliance.
We need to thank many people for their assistance in producing this
manual. Jay Fenlason contributed many ideas and sample programs.
Richard Mlynarik and Robert J. Chassell gave helpful comments on early
drafts of this manual. The paper `A Supplemental Document for `awk''
by John W. Pierce of the Chemistry Department at UC San Diego,
pinpointed several issues relevant both to `awk' implementation and to
this manual, that would otherwise have escaped us. David Trueman, Pat
Rankin, and Michal Jaegermann also contributed sections of the manual.
The following people provided many helpful comments on this edition
of the manual: Rick Adams, Michael Brennan, Rich Burridge, Diane Close,
Christopher ("Topher") Eliot, Michael Lijewski, Pat Rankin, Miriam
Robbins, and Michal Jaegermann. Robert J. Chassell provided much
valuable advice on the use of Texinfo.
Finally, we would like to thank Brian Kernighan of Bell Labs for
invaluable assistance during the testing and debugging of `gawk', and
for help in clarifying numerous points about the language.
File: gawk.info, Node: Copying, Next: This Manual, Prev: Preface, Up: Top
GNU GENERAL PUBLIC LICENSE
**************************
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and dist