⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gawk.texi

📁 早期freebsd实现
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
\input texinfo   @c -*-texinfo-*-@c %**start of header (This is for running Texinfo on a region.)@setfilename gawk.info@settitle The GAWK Manual@c @smallbook@c %**end of header (This is for running Texinfo on a region.)@ifinfo@synindex fn cp@synindex vr cp@end ifinfo@iftex@syncodeindex fn cp@syncodeindex vr cp@end iftex@c If "finalout" is commented out, the printed output will show@c black boxes that mark lines that are too long.  Thus, it is@c unwise to comment it out when running a master in case there are@c overfulls which are deemed okay.@iftex@finalout@end iftex@c ===> NOTE! <==@c Determine the edition number in *four* places by hand:@c   1. First ifinfo section  2. title page  3. copyright page 4. top node@c To find the locations, search for !!set@ifinfoThis file documents @code{awk}, a program that you can use to selectparticular records in a file and perform operations upon them.This is Edition 0.15 of @cite{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 ofthis manual provided the copyright notice and this permission noticeare preserved on all copies.@ignorePermission is granted to process this file through TeX and print theresults, provided the printed document carries copying permissionnotice identical to this one except for the removal of this paragraph(this paragraph not being relevant to the printed manual).@end ignorePermission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided that the entireresulting derived work is distributed under the terms of a permissionnotice identical to this one.Permission is granted to copy and distribute translations of this manualinto another language, under the above conditions for modified versions,except that this permission notice may be stated in a translation approvedby the Foundation.@end ifinfo@setchapternewpage odd@c !!set edition, date, version@titlepage@title The GAWK Manual@subtitle Edition 0.15@subtitle April 1993@author Diane Barlow Close@author Arnold D. Robbins@author Paul H. Rubin@author Richard Stallman@c Include the Distribution inside the titlepage environment so@c that headings are turned off.  Headings on and off do not work.@page@vskip 0pt plus 1filllCopyright @copyright{} 1989, 1991, 1992, 1993 Free Software Foundation, Inc.@sp 2        @c !!set edition, date, versionThis is Edition 0.15 of @cite{The GAWK Manual}, @*for the 2.15 version of the GNU implementation @*of AWK.@sp 2Published by the Free Software Foundation @*675 Massachusetts Avenue @*Cambridge, MA 02139 USA @*Printed copies are available for $20 each.Permission is granted to make and distribute verbatim copies ofthis manual provided the copyright notice and this permission noticeare preserved on all copies.Permission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided that the entireresulting derived work is distributed under the terms of a permissionnotice identical to this one.Permission is granted to copy and distribute translations of this manualinto another language, under the above conditions for modified versions,except that this permission notice may be stated in a translation approvedby the Foundation.@end titlepage@ifinfo@node Top, Preface, (dir), (dir)@comment  node-name,  next,  previous,  up@top General Introduction@c Preface or Licensing nodes should come right after the Top@c node, in `unnumbered' sections, then the chapter, `What is gawk'.This file documents @code{awk}, a program that you can use to selectparticular records in a file and perform operations upon them.@c !!set edition, date, versionThis is Edition 0.15 of @cite{The GAWK Manual}, @*for the 2.15 version of the GNU implementation @*of AWK.@end ifinfo@menu* Preface::                     What you can do with @code{awk}; brief history                                and acknowledgements.* Copying::                     Your right to copy and distribute @code{gawk}.* This Manual::                 Using this manual.                                 Includes sample input files that you can use.* Getting Started::             A basic introduction to using @code{awk}.                                How to run an @code{awk} program.                                  Command line syntax.* Reading Files::               How to read files and manipulate fields.* Printing::                    How to print using @code{awk}.  Describes the                                @code{print} and @code{printf} statements.                                  Also describes redirection of output.* One-liners::                  Short, sample @code{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 @code{gawk}.* Language History::            The evolution of the @code{awk} language.* Installation::                Installing @code{gawk} under                                 various operating systems.* Gawk Summary::                @code{gawk} Options and Language Summary.* Sample Program::              A sample @code{awk} program with a                                 complete explanation.* Bugs::                        Reporting Problems and Bugs.* Notes::                       Something about the                                 implementation of @code{gawk}.* Glossary::                    An explanation of some unfamiliar terms.* Index::                       @end menu@node Preface, Copying, Top, Top@comment  node-name,  next,  previous,  up@unnumbered Preface@iftex@cindex what is @code{awk}@end iftexIf you are like many computer users, you would frequently like to makechanges in various text files wherever certain patterns appear, orextract data from parts of certain lines while discarding the rest.  Towrite a program to do this in a language such as C or Pascal is atime-consuming inconvenience that may take many lines of code.  The jobmay be easier with @code{awk}.The @code{awk} utility interprets a special-purpose programming languagethat makes it possible to handle simple data-reformatting jobs easilywith just a few lines of code.The GNU implementation of @code{awk} is called @code{gawk}; it is fullyupward compatible with the System V Release 4 version of@code{awk}.  @code{gawk} is also upward compatible with the @sc{posix}(draft) specification of the @code{awk} language.  This means that allproperly written @code{awk} programs should work with @code{gawk}.Thus, we usually don't distinguish between @code{gawk} and other @code{awk}implementations in this manual.@refill@cindex uses of @code{awk}This manual teaches you what @code{awk} does and how you can use@code{awk} effectively.  You should already be familiar with basicsystem commands such as @code{ls}.  Using @code{awk} you can: @refill@itemize @bullet@itemmanage small, personal databases@itemgenerate reports@itemvalidate data@itemproduce indexes, and perform other document preparation tasks@itemeven experiment with algorithms that can be adapted later to other computerlanguages@end itemize@iftexThis 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 theexpert user, and for the on-line Info version of the manual.@end iftex@menu* History::                     The history of @code{gawk} and                                @code{awk}.  Acknowledgements.@end menu@node History,  , Preface, Preface@comment  node-name,  next,  previous,  up@unnumberedsec History of @code{awk} and @code{gawk}@cindex acronym@cindex history of @code{awk}The name @code{awk} comes from the initials of its designers: Alfred V.Aho, Peter J. Weinberger, and Brian W. Kernighan.  The original version of@code{awk} was written in 1977.  In 1985 a new version made the programminglanguage more powerful, introducing user-defined functions, multiple inputstreams, 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 cleanedup the behavior in some of the ``dark corners'' of the language.The specification for @code{awk} in the @sc{posix} Command Languageand Utilities standard further clarified the language based on feedbackfrom both the @code{gawk} designers, and the original @code{awk}designers.@refillThe GNU implementation, @code{gawk}, was written in 1986 by Paul Rubinand Jay Fenlason, with advice from Richard Stallman.  John Woodscontributed parts of the code as well.  In 1988 and 1989, David Trueman, withhelp from Arnold Robbins, thoroughly reworked @code{gawk} for compatibilitywith the newer @code{awk}.  Current development (1992) focuses on bug fixes,performance improvements, and standards compliance.We need to thank many people for their assistance in producing thismanual.  Jay Fenlason contributed many ideas and sample programs.  RichardMlynarik and Robert J. Chassell gave helpful comments on early drafts of thismanual.  The paper @cite{A Supplemental Document for @code{awk}} by John W.Pierce of the Chemistry Department at UC San Diego, pinpointed severalissues relevant both to @code{awk} implementation and to this manual, thatwould otherwise have escaped us.  David Trueman, Pat Rankin, and MichalJaegermann also contributed sections of the manual.@refillThe following people provided many helpful comments on this edition ofthe 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 onthe use of Texinfo.Finally, we would like to thank Brian Kernighan of Bell Labs for invaluableassistance during the testing and debugging of @code{gawk}, and forhelp in clarifying numerous points about the language.@refill@node Copying, This Manual, Preface, Top@unnumbered GNU GENERAL PUBLIC LICENSE@center Version 2, June 1991@displayCopyright @copyright{} 1989, 1991 Free Software Foundation, Inc.675 Mass Ave, Cambridge, MA 02139, USAEveryone is permitted to copy and distribute verbatim copiesof this license document, but changing it is not allowed.@end display@c fakenode --- for prepinfo@unnumberedsec Preamble  The licenses for most software are designed to take away yourfreedom to share and change it.  By contrast, the GNU General PublicLicense is intended to guarantee your freedom to share and change freesoftware---to make sure the software is free for all its users.  ThisGeneral Public License applies to most of the Free SoftwareFoundation's software and to any other program whose authors commit tousing it.  (Some other Free Software Foundation software is covered bythe GNU Library General Public License instead.)  You can apply it toyour programs, too.  When we speak of free software, we are referring to freedom, notprice.  Our General Public Licenses are designed to make sure that youhave the freedom to distribute copies of free software (and charge forthis service if you wish), that you receive source code or can get itif you want it, that you can change the software or use pieces of itin new free programs; and that you know you can do these things.  To protect your rights, we need to make restrictions that forbidanyone to deny you these rights or to ask you to surrender the rights.These restrictions translate to certain responsibilities for you if youdistribute copies of the software, or if you modify it.  For example, if you distribute copies of such a program, whethergratis or for a fee, you must give the recipients all the rights thatyou have.  You must make sure that they, too, receive or can get thesource code.  And you must show them these terms so they know their

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -