Use of awk

Solo disponible en BuenasTareas
  • Páginas : 58 (14295 palabras )
  • Descarga(s) : 0
  • Publicado : 9 de marzo de 2012
Leer documento completo
Vista previa del texto
The AWK Manual
Edition 1.0 December 1995

Diane Barlow Close Arnold D. Robbins Paul H. Rubin Richard Stallman Piet van Oostrum

Copyright c 1989, 1991, 1992, 1993 Free Software Foundation, Inc.

This is Edition 1.0 of The AWK Manual, for the new implementation of AWK (sometimes called nawk).

Notice: This work is derived from the original gawk manual. Adaptions for NAWK made by Piet vanOostrum, Dec. 1995, July 1998.

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 apermission 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.

Preface

1

Preface
If you are like many computer users, you would frequently like to make changes in varioustext 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 simpledata-reformatting jobs easily with just a few lines of code. 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 adaptedlater to other computer languages

This manual has the difficult task of being both tutorial and reference. If you are a novice, feel free to skip over details that seem too complex. You should also ignore the many cross references; they are for the expert user, and for the on-line Info version of the manual.

History of awk
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 upthe 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. 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. Thepaper 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: RickAdams, 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.

2

The AWK Manual

GNU GENERAL PUBLIC LICENSE

3

GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Copyright c 1989, 1991 Free Software Foundation, Inc. 675 Mass...
tracking img