diff options
Diffstat (limited to 'doc/awkcard.in')
-rw-r--r-- | doc/awkcard.in | 344 |
1 files changed, 186 insertions, 158 deletions
diff --git a/doc/awkcard.in b/doc/awkcard.in index 1c4d1910..556bdc1e 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -1,7 +1,8 @@ .\" AWK Reference Card --- Arnold Robbins, arnold@skeeve.com .\" .\" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, -.\" 2003, 2004, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. +.\" 2003, 2004, 2005, 2007, 2009, 2010, 2011, 2012, 2013, 2014 +.\" Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission @@ -25,8 +26,7 @@ .\" Strings to save typing .ds AK \*(FCawk\*(FR .ds GK \*(FCgawk\*(FR -.ds PK \*(FCpgawk\*(FR -.ds NK Bell Labs \*(FCawk\*(FR +.ds NK Brian Kernighan's \*(FCawk\*(FR .ds MK \*(FCmawk\*(FR .\" .\" @@ -64,7 +64,7 @@ Environment Variables (\*(GK) 11 Escape Sequences 9 Expressions 7 Fields 10 -FTP/HTTP Information 18 +FTP/HTTP/GIT Information 18 Historical Features (\*(GK) 10 Input Control 13 Internationalization (\*(GK) 18 @@ -76,10 +76,10 @@ Pattern Elements 8 Printf Formats 14 Records 10 Regular Expressions 11 -Signals (\*(PK) 4 +Signals (\*(GK \*(FC\-\^\-profile\*(FR) 4 Special Filenames 12 String Functions 16 -Time Functions (\*(GK) 17 +Time Functions 17 Type Functions (\*(GK) 18 User-defined Functions 15 Variables 5\*(CX @@ -100,8 +100,8 @@ Brian Kernighan and Michael Brennan who reviewed it. \*(CD .SL .nf -\*(FRCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. +\*(FRCopyright \(co 1996\(en2005, 2007, 2009\(en2014 +Free Software Foundation, Inc. .nf .BT @@ -113,7 +113,7 @@ Brian Kernighan and Michael Brennan who reviewed it. .ES \*(CDThis card describes POSIX AWK, as well as three freely available \*(AK implementations -(see \fHFTP/HTTP Information\fP below). +(see \fHFTP/HTTP/GIT Information\fP). \*(CLCommon extensions (in two or more versions) are printed in light blue. \*(CBFeatures specific to just one version\(emusually GNU AWK (\*(GK)\(emare printed in dark blue. @@ -146,7 +146,7 @@ or .sp .5 \*(FIescape sequences\fP \- a special sequence of characters beginning with a backslash, used to describe otherwise unprintable characters. -(See \fHEscape Sequences\fP below.) +(See \fHEscape Sequences\fP.) .sp .5 \*(FIstring\fP \- a group of characters enclosed in double quotes. Strings may contain \*(FIescape sequences\*(FR. @@ -249,25 +249,29 @@ copyright information on \*(FCstdout\*(FR. .TI "\*(FC\-d\*(FR[\*(FIfile\*(FR], \*(FC\-\^\-dump-variables\*(FR[\*(FC=\*(FIfile\*(FR] Print a sorted list of global variables, their types and final values to -\*(FIfile\*(FR. -If no \*(FIfile\*(FR -is provided, \*(FCgawk\*(FR -uses \*(FCawkvars.out\*(FR. +\*(FIfile\*(FR (default: \*(FCawkvars.out\*(FR). +.TI "\*(FC\-D\*(FR[\*(FC\*(FIfile\*(FR], \*(FC\-\^\-debug\*(FR[\*(FC=\*(FIfile\*(FR] +Enable debugging of program. Optionally read stored commands +from \*(FIfile\*(FR. .TI "\*(FC-e '\*(FItext\*(FC'\*(FR, \*(FC\-\^\-source '\*(FItext\*(FC'\*(FR Use \*(FItext\*(FR as AWK program source code. .TI "\*(FC\-E \*(FIfile\*(FR, \*(FC\-\^\-exec \*(FIfile\*(FR Read program text from \*(FIfile\fP. No other options are processed. -Also disables command-line variable assignments. +Also disable command-line variable assignments. Useful with \*(FC#!\fP. .TI "\*(FC\-g\*(FR, \*(FC\-\^\-gen\-pot\*(FR Process the program and print a GNU \*(FCgettext\*(FR -format \*(FC\&.pot\*(FR file on standard output, +format \*(FC\&.pot\*(FR file on \*(FCstdout\*(FR, containing the text of all strings that were marked for localization. .TI "\*(FC\-h\*(FR, \*(FC\-\^\-help\*(FR Print a short summary of the available options on \*(FCstdout\*(FR, then exit zero. +.TI "\*(FC\-i \*(FIfile\*(FR, \*(FC\-\^\-include \*(FIfile\*(FR +Include library AWK code in \*(FIfile\*(FR. +.TI "\*(FC\-l \*(FIlib\*(FR, \*(FC\-\^\-load \*(FIlib\*(FR +Load dynamic extension \*(FIlib\fP. .TI "\*(FC\-L \*(FR[\*(FC\*(FIvalue\*(FR], \*(FC\-\^\-lint\*(FR[\*(FC=\*(FIvalue\*(FR] Warn about dubious or non-portable constructs. If \*(FIvalue\*(FR is @@ -277,36 +281,25 @@ If \*(FIvalue\*(FR is \*(FCinvalid\*(FR, only issue warnings about things that are actually invalid (not fully implemented yet). +.TI "\*(FC\-M\*(FR, \*(FC\-\^\-bignum\*(FR +Enable arbitrary-precision arithmetic. .TI "\*(FC\-n\*(FR, \*(FC\-\^\-non\-decimal\-data\*(FR Recognize octal and hexadecimal values in input data. \*(FIUse this option with great caution!\*(FR .TI "\*(FC\-N\*(FR, \*(FC\-\^\-use\-lc\-numeric\*(FR Force use of the locale's decimal point character when parsing input data. +.TI "\*(FC\-o\*(FR[\*(FC\*(FIfile\*(FR], \*(FC\-\^\-pretty-print\*(FR[\*(FC=\*(FIfile\*(FR] +Output a pretty printed version of the program to \*(FIfile\*(FR +(default: \*(FCawkprof.out\*(FR). .TI "\*(FC\-O\*(FR, \*(FC\-\^\-optimize\*(FR Enable some internal optimizations. .TI "\*(FC\-p\*(FR[\*(FC\*(FIfile\*(FR], \*(FC\-\^\-profile\*(FR[\*(FC=\*(FIfile\*(FR] Send profiling data to \*(FIfile\*(FR (default: \*(FCawkprof.out\*(FR). -With \*(GK, -the profile is just a ``pretty printed'' version of the program. -With \*(PK, -the profile contains execution counts in the left margin +The profile contains execution counts in the left margin of each statement in the program. .TI "\*(FC\-P\*(FR, \*(FC\-\^\-posix\*(FR -Disable common and GNU extensions. -.TI "\*(FC\-R \*(FIfile\*(FR, \*(FC\-\^\-command \*(FIfile\*(FR" -\*(FCdgawk\*(FR only. -Read stored debugger commands from \*(FIfile\*(FR. -.TI "\*(FC\-r\*(FR, \*(FC\-\^\-re\-interval\*(FR -Enable \*(FIinterval expressions\*(FR in regular -expression matching (see \fHRegular -Expressions\fP below). Useful if -\*(FC\-\^\-traditional\*(FR is specified. -.TI "\*(FC\-S\*(FR, \*(FC\-\^\-sandbox\*(FR -Disable the \*(FCsystem()\*(FR function, -input redirection with \*(FCgetline\*(FR, -output redirection with \*(FCprint\*(FR and \*(FCprintf\*(FR, -and dynamic extensions loading.\*(CB +Disable common and GNU extensions.\*(CB .in -4n .EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(GK\f(HB)\*(FR\s0" @@ -318,6 +311,14 @@ and dynamic extensions loading.\*(CB .ES .fi .in +4n +.TI "\*(FC\-r\*(FR, \*(FC\-\^\-re\-interval\*(FR +Enable \*(FIinterval expressions\*(FR. +(Needed with \*(FC\-c\*(FR.) +.TI "\*(FC\-S\*(FR, \*(FC\-\^\-sandbox\*(FR +Disable the \*(FCsystem()\*(FR function, +input redirection with \*(FCgetline\*(FR, +output redirection with \*(FCprint\*(FR and \*(FCprintf\*(FR, +and loading dynamic extensions. .TI "\*(FC-t\*(FR, \*(FC\-\^\-lint\-old\*(FR Warn about constructs that are not portable to the original version of @@ -330,14 +331,14 @@ and exit zero. .in -4n .sp .5 .fi -In compatibility mode, -any other options are flagged as invalid, but are otherwise ignored. Normally, if there is program text, unknown options are passed on to the AWK program in \*(FCARGV\*(FR -for processing.\*(CB +for processing. +In compatibility mode, +unknown options are flagged as invalid, but are otherwise ignored.\*(CB .EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(GK\f(HB)\*(FR\s0" - +.sp .4 .\" .\" .\" --- Command Line Arguments (mawk) @@ -370,7 +371,7 @@ Adjust the size of \*(MK's internal T} \*(FC\-W version\*(FR T{ Print version and copyright on -\*(FCstdout\fP and limit information on \*(FCstderr\fP +\*(FCstdout\fP, limit information on \*(FCstderr\fP, and exit zero. T} .TE @@ -382,14 +383,14 @@ The options may be abbreviated using just the first letter, e.g., and so on.\*(CB .EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(MK\f(HB)\*(FR\s0" .sp .7 -.\" --- Signals (pgawk) +.\" --- Signals (gawk --profile) .ES .fi -\*(CD\*(PK accepts two signals. +\*(CD\*(GK accepts two signals while profiling. \*(FCSIGUSR1\fP dumps a profile and function call stack to the profile file. It then continues to run. \*(FCSIGHUP\fP is similar, but exits.\*(CB -.EB "\s+2\f(HBSIGNALS (\*(PK\f(HB)\*(FR\s0" +.EB "\s+2\f(HBSIGNALS (\*(GK \f(HB\-\^\-profile)\*(FR\s0" .\" --- Lines And Statements .ES @@ -407,14 +408,14 @@ which prints the entire record. .sp .5 Comments begin with the \*(FC#\*(FR character, and continue until the end of the line. -Normally, a statement ends with a newline, but lines ending in +Normally, statements end with a newline, but lines ending in a ``,'', \*(FC{\*(FR, \*(CB\*(FC?\*(FR, \*(FC:\*(FR,\*(CD -\*(FC&&\*(FR +\*(FC&&\*(FR, or -\*(FC||\*(FR +\*(FC||\*(FR, are automatically continued. Lines ending in \*(FCdo\fP or \*(FCelse\fP also have their statements automatically continued on the following line. @@ -435,7 +436,9 @@ and to the pattern-action statements themselves.\*(CX \*(CDAWK programs are a sequence of pattern-action statements and optional function definitions. .sp .5 - \*(CB\*(FC@include "\*(FIfilename\*(FC"\*(CD + \*(CB\*(FC@include "\*(FIfilename\*(FC" +.br + \*(FC@load "\*(FIfilename\*(FC"\*(CD .br \*(FIpattern\*(FC { \*(FIaction statements\*(FC }\*(FR .br @@ -449,8 +452,10 @@ The program text is read as if all the \*(FIprog-file\*(FR(s) \*(CBand command line source texts\*(CD had been concatenated. .sp -\*(GK includes files named on \*(FC@include\*(FR lines. -Nested includes are allowed.\*(CD +\*(CB\*(GK includes files named on \*(FC@include\*(FR lines. +Nested includes are allowed. +\*(GK loads extensions named on \*(FC@load\*(FR lines; +see \fHDynamic Extensions\*(FR.\*(CD .sp .5 AWK programs execute in the following order. First, all variable assignments specified via the \*(FC\-v\fP @@ -458,15 +463,13 @@ option are performed. Next, \*(AK executes the code in the \*(FCBEGIN\fP rules(s), if any, and then proceeds to read the files \*(FC1\fP through \*(FCARGC \- 1\fP in the \*(FCARGV\fP array. -(Adjusting \*(FCARGC\fP and \*(FCARGV\fP thus provides control over -the input files that will be processed.) If there are no files named on the command line, \*(AK reads the standard input. .sp .5 -If a command line argument has the form +A command line argument of the form \*(FIvar\*(FC=\*(FIval\*(FR, -it is treated as a variable assignment. The variable -\*(FIvar\fP will be assigned the value \*(FIval\*(FR. +is treated as a variable assignment. The variable +\*(FIvar\fP is assigned the value \*(FIval\*(FR. (This happens after any \*(FCBEGIN\fP rule(s) have been run.) ... delete this paragraph if no space Command line variable assignment @@ -502,7 +505,7 @@ If a program only has an \*(FCEND\fP rule, the input is read. .fi .TS expand; -l lw(2i). +l lw(2.3i). \*(CD\*(FCARGC\fP T{ Number of command line arguments. T} @@ -539,12 +542,12 @@ is \*(FC"%.6g"\*(FR. T} \*(FCENVIRON\fP T{ Array containing the current environment. -it is indexed by the environment -variables, each element being the value of +It is indexed by the environment +variable names, each element being the value of that variable. T} \*(CB\*(FCERRNO\fP T{ -String describing the error if a +String error value if a \*(FCgetline\*(FR redirection or read fails, or if @@ -571,7 +574,11 @@ instead of the field separator.\*(CD T} \*(FCFS\fP T{ Input field separator, a space by default -(see \fHFields\fP above). +(see \fHFields\fP). +T} +\*(CB\*(FCFUNCTAB\fP T{ +An array indexed by the names of all user-defined +and extension functions.\*(CD T} \*(CB\*(FCIGNORECASE\fP T{ If non-zero, all regular expression and string @@ -587,13 +594,8 @@ T} \*(CB\*(FCLINT\fP T{ Provides dynamic control of the \*(FC\-\^\-lint\fP option from within an AWK program. -When true, \*(GK -prints lint warnings. -When assigned the string value \*(FC"fatal"\*(FR, -lint warnings become fatal errors. -Any other true value just prints warnings.\*(CD T} -\*(FCNF\fP T{ +\*(CD\*(FCNF\fP T{ Number of fields in the current input record. T} \*(FCNR\fP T{ @@ -608,7 +610,11 @@ T} \*(FCORS\fP T{ Output record separator, a newline by default. T} -\*(CB\*(FCPROCINFO\fP T{ +\*(CB\*(FCPREC\fP T{ +The working precision of arbitrary precision floating-point +numbers, 53 by default. +T} +\*(FCPROCINFO\fP T{ Elements of this array provide access to information about the running AWK program. See \*(AM for details.\*(CD @@ -617,9 +623,13 @@ T} Length of the string matched by \*(FCmatch()\*(FR; \-1 if no match. T} +\*(CB\*(FCROUNDMODE\fP T{ +The rounding mode to use for arbitrary precision arithmetic, +by default \*(FC"N"\fP.\*(CD +T} \*(FCRS\fP T{ Input record separator, a newline by default -(see \fHRecords\fP above). +(see \fHRecords\fP). T} \*(FCRSTART\fP T{ Index of the first character matched by @@ -633,7 +643,12 @@ T} \*(FCSUBSEP\fP T{ Character(s) used to separate multiple subscripts in array elements, by default \*(FC"\e034"\*(FR. (See -\fHArrays\fP below). +\fHArrays\fP). +T} +\*(CB\*(FCSYMTAB\fP T{ +An array indexed by the names of all global +variables and arrays. May be used to indirectly +set variable and array values.\*(CD T} \*(CB\*(FCTEXTDOMAIN\fP T{ The internationalization text domain, @@ -654,7 +669,7 @@ If the expression is a list (\*(FIexpr\*(FC, \*(FIexpr \*(FR...), then the subscript is a string consisting of the concatenation of the (string) value of each expression, -separated by the value of the \*(FCSUBSEP\fP variable. +separated by the value of \*(FCSUBSEP\fP. This simulates multi-dimensional arrays. For example: .nf @@ -685,9 +700,11 @@ loop to iterate over all the elements of an array. .sp .5 Use the \*(FCdelete\fP statement to delete an element from an array. -\*(CLSpecifying just the array name without a subscript in +Specifying just the array name without a subscript in the \*(FCdelete\fP statement deletes the entire contents of an array. +\*(CBYou cannot use \*(FCdelete\fP with \*(FCFUNCTAB\fP +or \*(FCSYMTAB\fP.\*(CD .sp .5 \*(CB\*(GK provides true multidimensional arrays. Such arrays need not be ``rectangular'' as in C or C++. For example: @@ -766,6 +783,10 @@ it will be treated as a string. To force a variable to be treated as a number, add 0 to it; to force it to be treated as a string, concatenate it with the null string. .sp .5 +Uninitialized variables have the numeric value 0 and the string value +\*(FC"\^"\fP +(the null, or empty, string). +.sp .5 When a string must be converted to a number, the conversion is accomplished using \*(FIstrtod\*(FR(3). A number is converted to a string by using the value of \*(FCCONVFMT\fP @@ -790,11 +811,7 @@ elements and the elements of an array created by \*(FCsplit()\fP \*(CBor \*(FCpatsplit()\fP\*(CD that are numeric strings. The basic idea is that \*(FIuser input\*(FR, and only user input, that looks numeric, -should be treated that way.\*(CD -.sp .5 -Uninitialized variables have the numeric value 0 and the string value -\*(FC"\^"\fP -(the null, or empty, string).\*(CX +should be treated that way.\*(CX .EB "\s+2\f(HBCONVERSIONS AND COMPARISONS\*(FR\s0" .\" --- Pattern Elements @@ -820,7 +837,7 @@ in a program, including different source files. \*(CB\*(FCBEGINFILE\*(FR and \*(FCENDFILE\*(FR are special patterns that execute before the first record of each file and after the last record of each file, respectively. In the \*(FCBEGINFILE\*(FR rule, the \*(FCERRNO\*(FR -variable is non-null if there is a problem with the file; the code should use +variable is non-null if there is a problem with the file; the rule should use \*(FCnextfile\*(FR to skip the file if desired. Otherwise \*(GK exits with its usual fatal error. The actions for multiple \*(FCBEGINFILE\*(FR and \*(FCENDFILE\*(FR patterns are merged.\*(CD @@ -860,9 +877,9 @@ or go to the \*(FIincr\*(FR part of a \*(FCfor\*(FR loop. .br Delete element \*(FIindex\*(FR from array \*(FIarray\*(FR. .ti -.2i -\*(CL\*(FCdelete \*(FIarray\^\*(FR +\*(FCdelete \*(FIarray\^\*(FR .br -Delete all elements from array \*(FIarray\*(FR.\*(CD +Delete all elements from array \*(FIarray\*(FR. .ti -.2i \*(FCdo \*(FIstatement \*(FCwhile (\*(FIcondition\*(FC)\*(FR .br @@ -899,7 +916,7 @@ matches the closest \*(FCif\*(FR. .ti -.2i \*(FCnext\*(FR See \fHInput Control.\fP .ti -.2i -\*(CL\*(FCnextfile\*(FR See \fHInput Control.\fP\*(CD +\*(FCnextfile\*(FR See \fHInput Control.\fP .in -.2i .\" --- Start switch statement \*(CB\*(FCswitch (\*(FIexpression\*(FC) { @@ -1016,7 +1033,7 @@ or overrides the use of \*(FCFPAT\fP.\*(CD .sp .5 -Each field in the input record may be referenced by its position, +Each field in the input record may be referenced by its position: \*(FC$1\*(FR, \*(FC$2\*(FR and so on. \*(FC$0\fP is the whole record. Fields may also be assigned new values. @@ -1025,7 +1042,7 @@ The variable \*(FCNF\fP is set to the total number of fields in the input record. .sp .5 References to non-existent fields (i.e., fields after \*(FC$NF\*(FR) -produce the null-string. However, assigning to a non-existent field +produce the null string. However, assigning to a non-existent field (e.g., \*(FC$(NF+2) = 5\*(FR) increases the value of \*(FCNF\*(FR, creates any intervening fields with the null string as their value, and causes the value of \*(FC$0\fP @@ -1033,7 +1050,7 @@ to be recomputed with the fields being separated by the value of \*(FCOFS\*(FR. References to negative numbered fields cause a fatal error. Decreasing the value of \*(FCNF\fP causes the trailing fields to be lost -\*(CR(not \*(NK).\*(CX +\*(CR(not \*(NK)\*(CD.\*(CX .EB "\s+2\f(HBFIELDS\*(FR\s0" .\" --- Historical Features @@ -1068,7 +1085,7 @@ Summary of Regular Expressions In Decreasing Precedence _ \*(FC(\^\*(FIr\*(FC)\*(FR~regular expression (for grouping) -\*(FIc\*(FR~if non-special char, matches itself +\*(FIc\*(FR~if non-special character, matches itself \*(FC\e\*(FI\^c\*(FR~turn off special meaning of \*(FIc\fP \*(FC^\*(FR~beginning of string (note: \*(FInot\fP line) \*(FC$\*(FR~end of string (note: \*(FInot\fP line) @@ -1093,9 +1110,10 @@ _ .TE .sp .5 .fi -\*(CRThe \*(FIr\*(FC{\*(FIn\*(FC,\*(FIm\*(FC}\*(FR notation is called an -\*(FIinterval expression\fP. POSIX mandates it for AWK regexps, but -most \*(AKs don't implement it.\*(CX +The \*(FIr\*(FC{\*(FIn\*(FC,\*(FIm\*(FC}\*(FR notation is called an +\*(FIinterval expression\fP. +\*(CRNot supported by +\*(MK or \*(NK.\*(CX .sp .5 \*(CDIn regular expressions, within character ranges (\*(FC[\*(FR...\*(FC]\*(FR), @@ -1128,16 +1146,23 @@ The default path is If a file name given to the \*(FC\-f\fP option contains a ``/'' character, no path search is performed. .sp .5 -.PP +The variable \*(FCAWKLIBPATH\fP +specifies the search path for dynamic extensions to use +with \*(FC@load\fP and the \*(FC\-l\fP option. +.sp .5 For socket communication, \*(FCGAWK_SOCK_RETRIES\fP -controls the number of retries, and +controls the number of connection retries, and \*(FCGAWK_MSEC_SLEEP\fP controls the interval between retries. The interval is in milliseconds. On systems that do not support \*(FIusleep\fP(3), the value is rounded up to an integral number of seconds. .sp .5 +The value of \*(FCGAWK_READ_TIMEOUT\fP specifies the time, in milliseconds, +for \*(GK to +wait for input before returning with an error. +.sp .5 If \*(FCPOSIXLY_CORRECT\fP exists .\" in the environment, then \*(GK @@ -1158,7 +1183,7 @@ your program. .ti +5n \*(FCBEGIN { TEXTDOMAIN = "myprog" }\*(FR .sp .3 -This allows \*(GK to find the \*(FC\&.mo\*(FR +This allows \*(GK to find the \*(FC\&.gmo\*(FR file associated with your program. Without this step, \*(GK uses the \*(FCmessages\*(FR text domain, which probably won't work. @@ -1181,7 +1206,7 @@ to generate a \*(FC\&.pot\*(FR file for your program. .sp .5 5. Provide appropriate translations, and build and install a corresponding -\*(FC\&.mo\*(FR file. +\*(FC\&.gmo\*(FR file. .sp .5 The internationalization features are described in full detail in \*(AM.\*(CB .EB "\s+2\f(HBLOCALIZATION (\*(GK\f(HB)\*(FR\s0" @@ -1204,7 +1229,7 @@ The filenames are: expand; l lw(2i). \*(FC"\-"\fP standard input -\*(FC/dev/stdin\fP standard input \*(CR(not \*(MK)\*(CD +\*(FC/dev/stdin\fP standard input \*(FC/dev/stdout\fP standard output \*(FC/dev/stderr\fP standard error output .TE @@ -1266,11 +1291,16 @@ T} \*(FCgetline \*(FIv \*(FC< \*(FIfile\*(FR Set \*(FIv\fP from next record of \*(FIfile\*(FR. \*(FIcmd \*(FC| getline\*(FR Pipe into \*(FCgetline\*(FR; set \*(FC$0\*(FR, \*(FCNF\*(FR. \*(FIcmd \*(FC| getline \*(FIv\*(FR Pipe into \*(FCgetline\*(FR; set \*(FIv\*(FR. -\*(CB\*(FIcmd \*(FC|& getline\*(FR Co-process pipe into \*(FCgetline\*(FR; set \*(FC$0\*(FR, \*(FCNF\*(FR. +.\" \*(CB\*(FIcmd \*(FC|& getline\*(FR Co-process pipe into \*(FCgetline\*(FR; set \*(FC$0\*(FR, \*(FCNF\*(FR. .TE .fi .in +.2i .ti -.2i +\*(CB\*(FIcmd \*(FC|& getline\*(FR +.br +Co-process pipe into \*(FCgetline\*(FR; set \*(FC$0\*(FR, \*(FCNF\*(FR. +.br +.ti -.2i \*(FIcmd \*(FC|& getline \*(FIv\*(FR .br Co-process pipe into \*(FCgetline\*(FR; set \*(FIv\*(FR. @@ -1284,35 +1314,35 @@ program. Upon end of the input data, execute any \*(FCEND\fP rule(s). .br .ti -.2i -\*(CL\*(FCnextfile\fP +\*(FCnextfile\fP .br Stop processing the current input file. The next input record comes from the -next input file. \*(FCFILENAME\fP \*(CBand -\*(FCARGIND\fP\*(CL are updated, \*(FCFNR\fP is reset to 1, -and processing starts over with the first -pattern in the AWK program. Upon end -of input data, execute any \*(FCEND\fP rule(s).\*(CD +next input file. Update \*(FCFILENAME\fP \*(CBand +\*(FCARGIND\fP\*(CD, reset \*(FCFNR\fP to 1, +and start over with the first +pattern. Upon end +of input data, execute any \*(FCEND\fP rule(s). .in -.2i .sp .5 .fi \*(FCgetline\*(FR returns 1 on success, 0 on end of file, and \-1 on an error. -\*(CBUpon an error, \*(FCERRNO\*(FR contains a string describing +\*(CBAll versions set \*(FCRT\fP. +Upon an error, \*(FCERRNO\*(FR contains a string describing the problem.\*(CX .EB "\s+2\f(HBINPUT CONTROL\*(FR\s0" - +.sp .6 .\" --- Output Control .ES .fi .in +.2i .ti -.2i -\*(CL\*(FCfflush(\*(FR[\*(FIfile\^\*(FR]\*(FC)\*(FR +\*(CD\*(FCfflush(\*(FR[\*(FIfile\^\*(FR]\*(FC)\*(FR .br Flush any buffers associated -with the open output file or pipe \*(FIfile\*(FR.\*(CD -\*(CBIf no \*(FIfile\fP, then flush standard output. -If \*(FIfile\fP is null, then flush all open output files and pipes -(\*(GK and \*(NK)\*(CD. +with the open output file or pipe \*(FIfile\*(FR. +If no \*(FIfile\fP, or if +\*(FIfile\fP is null, then flush all open output files and pipes. .ti -.2i \*(FCprint\fP .br @@ -1327,7 +1357,7 @@ with \*(FCORS\fP. .ti -.2i \*(FCprintf \*(FIfmt\*(FC, \*(FIexpr-list\*(FR .br -Format and print (see \fHPrintf Formats\fP below). +Format and print (see \fHPrintf Formats\fP). .ti -.2i \*(FCsystem(\*(FIcmd\*(FC)\*(FR .br @@ -1358,7 +1388,7 @@ Print data down a pipeline to \*(FIcmd\*(FR. Print data down a pipeline to co-process \*(FIcmd\*(FR.\*(CX .in -.2i .EB "\s+2\f(HBOUTPUT CONTROL\*(FR\s0" - +.sp .6 .\" --- Closing Redirections .ES .fi @@ -1463,7 +1493,8 @@ Only has an effect when the field width is wider than the value to be printed. T} \*(CB\*(FC'\*(FR T{ -Use the locale's thousands separator for \*(FC%d\fP, \*(FC%i\fP, and \*(FC%u\fP.\*(CD +Use the locale's thousands separator and decimal +point characters.\*(CD T} \*(FIwidth\fP T{ Pad the field to this width. The field is normally @@ -1474,8 +1505,8 @@ T} Precision. The meaning of the \*(FIprec\*(FR varies by control letter: T} - \*(FC%d\*(FR, \*(FC%o\*(FR, \*(FC%i\*(FR, - \*(FC%u\*(FR, \*(FC%x\*(FR, \*(FC%X\fP T{ + \*(FC%d\*(FR,\|\*(FC%o\*(FR,\|\*(FC%i\fP, \0 + \*(FC%u\*(FR,\|\*(FC%x\*(FR,\|\*(FC%X\fP T{ The minimum number of digits to print. T} \*(FC%e\*(FR, \*(FC%E\*(FR, \*(FC%f\*(FR T{ @@ -1578,17 +1609,20 @@ expand; l lw(2i). \*(CD\*(FCatan2(\*(FIy\*(FC, \*(FIx\*(FC)\*(FR The arctangent of \*(FIy/x\fP in radians. \*(FCcos(\*(FIexpr\*(FC)\*(FR The cosine of \*(FIexpr\fP, which is in radians. +\*(CB\*(FCdiv(\*(FIn\*(FR\*(FC,\*(FI d\*(FR\*(FC,\*(FI res\*(FR\*(FC)\*(FR T{ +Return the result of integer division in \*(FIres\*(FR.\*(CD +T} \*(FCexp(\*(FIexpr\*(FC)\*(FR The exponential function (\*(FIe \*(FC^ \*(FIx\*(FR). \*(FCint(\*(FIexpr\*(FC)\*(FR Truncate to integer. \*(FClog(\*(FIexpr\*(FC)\*(FR The natural logarithm function (base \*(FIe\^\*(FR). -\*(FCrand()\fP A random number between 0 and 1 (0 \(<= \*(FIN\fP < 1). +\*(FCrand()\fP A random number \*(FIN\fP such that 0 \(<= \*(FIN\fP < 1. \*(FCsin(\*(FIexpr\*(FC)\*(FR The sine of \*(FIexpr\fP, which is in radians. -\*(FCsqrt(\*(FIexpr\*(FC)\*(FR The square root function. +\*(FCsqrt(\*(FIexpr\*(FC)\*(FR The square root of \*(FIexpr\fP. \&\*(FCsrand(\*(FR[\*(FIexpr\^\*(FR]\*(FC)\*(FR T{ Use \*(FIexpr\fP as the new seed for the random number -generator. If no \*(FIexpr\fP, the time of day is used. -Return the random number -generator's previous seed.\*(CX +generator. If no \*(FIexpr\fP, use the time of day. +Return the \" random number generator's +previous seed.\*(CX T} .TE .EB "\s+2\f(HBNUMERIC FUNCTIONS\*(FR\s0" @@ -1640,7 +1674,7 @@ replacement text is replaced with the text that was actually matched. Use \*(FC\e&\fP to get a literal \*(FC&\*(FR. See \*(AM for a fuller discussion of the rules for \*(FC&\*(FR's and backslashes in the replacement text of \*(CB\*(FCgensub()\*(FR,\*(CD \*(FCsub()\*(FR -and \*(FCgsub()\*(FR +and \*(FCgsub().\*(FR .ti -.2i \*(FCindex(\*(FIs\*(FC, \*(FIt\*(FC)\*(FR .br @@ -1669,7 +1703,7 @@ Subscripts \*(FCa[\*(FIn\^\*(FC, "start"]\*(FR, and \*(FCa[\*(FIn\^\*(FC, "length"]\*(FR -provide the starting index in the string and length +provide the starting index in the string and length, respectively, of each matching substring.\*(CD .ti -.2i \*(CB\*(FCpatsplit(\*(FIs\*(FC, \*(FIa \*(FR[\*(FC, \*(FIr \*(CB\*(FR[\*(FC, \*(FIseps \*(FR] \*(FR] \*(FC)\*(FR @@ -1695,7 +1729,7 @@ and return the number of fields. If \*(FIr\fP is omitted, use \*(FCFS\fP instead. Clear the \*(FIa\fP \*(CBand \*(FIseps\fP\*(CD first. Splitting behaves identically to field splitting. -(See \fHFields\fP, above.) +(See \fHFields\fP.) .ti -.2i \*(FCsprintf(\*(FIfmt\*(FC, \*(FIexpr-list\*(FC)\*(FR .br @@ -1715,12 +1749,11 @@ according to \*(FIfmt\*(FR, and return the result.\*(CX .br Examine \*(FIs\*(FR, and return its numeric value. If \*(FIs\*(FR begins with a leading \*(FC0\*(FR, -\*(FCstrtonum()\*(FR assumes that \*(FIs\*(FR -is an octal number. +treat it as an octal number. If \*(FIs\*(FR begins with a leading \*(FC0x\*(FR -or \*(FC0X\*(FR, \*(FCstrtonum()\*(FR assumes that -\*(FIs\*(FR is a hexadecimal number. Otherwise, the -number is treated as decimal.\*(CD +or \*(FC0X\*(FR, treat +\*(FIs\*(FR as a hexadecimal number. Otherwise, +treat the number as decimal.\*(CD .ti -.2i \*(FCsub(\*(FIr\*(FC, \*(FIs \*(FR[\*(FC, \*(FIt\*(FR]\*(FC)\*(FR .br @@ -1752,8 +1785,8 @@ left unchanged.\*(CX .\" --- Built-in Time Functions .ES .fi -\*(CD\*(GK -provides the following functions for obtaining time stamps and +\*(CD\*(GK and \*(MK +provide the following functions for obtaining time stamps and formatting them. .sp .5 .fi @@ -1775,33 +1808,32 @@ according to the specification in \*(FIformat\*(FR. The \*(FCsystime()\*(FR. If \*(FIutc-flag\*(FR is present and is non-zero or non-null, the result -is in UTC, otherwise the result is in local time. -If \*(FItimestamp\fP is missing, the current time of day is used. If +is in UTC, otherwise it is in local time. +If \*(FItimestamp\fP is missing, use the current time of day. If \*(FIformat\fP is missing, use \*(FCPROCINFO["strftime"]\fP. The default value is equivalent to the output -of \*(FIdate\*(FR(1). +of \*(FIdate\*(FR\^(1). .ti -.2i \*(FCsystime()\fP .br Return the current time of day as the number of -seconds since the Epoch.\*(CB +seconds since the Epoch.\*(CL .in -.2i -.EB "\s+2\f(HBTIME FUNCTIONS (\*(GK\f(HB)\*(FR\s0" +.EB "\s+2\f(HBTIME FUNCTIONS\*(FR\s0" .sp .6 .\" --- Built-in Bit Manipulation Functions .ES .fi \*(CD\*(GK -provides the following functions for doing bitwise operations. +provides the following bit manipulation functions. .sp .5 .fi .in +.2i .ti -.2i -\*(FCand(\*(FIv1\*(FC, \*(FIv2\*(FC)\*(FR +\*(FCand(\*(FIv1\*(FC, \*(FIv2\*(FR [\*(FC,\*(FR ... ]\*(FC)\*(FR .br -Return the bitwise AND of the values provided by -\*(FIv1\*(FR and \*(FIv2\*(FR. +Return the bitwise AND of the arguments. .ti -.2i \*(FCcompl(\*(FIval\*(FC)\*(FR .br @@ -1813,20 +1845,18 @@ Return the bitwise complement of Return the value of \*(FIval\*(FR, shifted left by \*(FIcount\*(FR bits. .ti -.2i -\*(FCor(\*(FIv1\*(FC, \*(FIv2\*(FC)\*(FR +\*(FCor(\*(FIv1\*(FC, \*(FIv2\*(FR [\*(FC,\*(FR ... ]\*(FC)\*(FR .br -Return the bitwise OR of the values provided by -\*(FIv1\*(FR and \*(FIv2\*(FR. +Return the bitwise OR of the arguments. .ti -.2i \*(FCrshift(\*(FIval\*(FC, \*(FIcount\*(FC)\*(FR .br Return the value of \*(FIval\*(FR, shifted right by \*(FIcount\*(FR bits. .ti -.2i -\*(FCxor(\*(FIv1\*(FC, \*(FIv2\*(FC)\*(FR +\*(FCxor(\*(FIv1\*(FC, \*(FIv2\*(FR [\*(FC,\*(FR ... ]\*(FC)\*(FR .br -Return the bitwise XOR of the values provided by -\*(FIv1\*(FR and \*(FIv2\*(FR.\*(CB +Return the bitwise XOR of the arguments.\*(CB .in -.2i .EB "\s+2\f(HBBIT MANIPULATION FUNCTIONS (\*(GK\f(HB)\*(FR\s0" .sp .6 @@ -1835,16 +1865,15 @@ Return the bitwise XOR of the values provided by .fi .in +.2i .ti -.2i -\*(CD\*(FCextension(\*(FIlib\*(FC, \*(FIfunc\*(FC)\*(FR +\*(CD\*(FC@load "\*(FIextension\*(FC"\*(FR .br -Dynamically load the shared library -\*(FIlib\*(FR -and call -\*(FIfunc\*(FR -in it to initialize the library. +Dynamically load the named \*(FIextension\*(FR. This adds new built-in functions to \*(GK. -It returns the value returned by -\*(FIfunc\*(FR.\*(CB +.\" The extension should use the API defined by the +.\" \*(FCgawkapi.h\*(FR header file, as documented in +.\" the full manual. +The extension is loaded during the parsing of the program. +See the manual for details.\*(CB .in -.2i .EB "\s+2\f(HBDYNAMIC EXTENSIONS (\*(GK\f(HB)\*(FR\s0" .BT @@ -1870,7 +1899,7 @@ provides the following functions for runtime message translation. .ti -.2i \*(FCbindtextdomain(\*(FIdirectory \*(FR[\*(FC, \*(FIdomain\*(FR]\*(FC)\*(FR .br -Specify the directory where \*(GK looks for the \*(FC\&.mo\*(FR +Specify the directory where \*(GK looks for the \*(FC\&.gmo\*(FR files, in case they will not or cannot be placed in the ``standard'' locations (e.g., during testing). @@ -1909,19 +1938,21 @@ to use the current domain.\*(CB .in -.2i .EB "\s+2\f(HBINTERNATIONALIZATION (\*(GK\f(HB)\*(FR\s0" .sp .5 -.\" --- FTP/HTTP Information +.\" --- FTP/HTTP/GIT Information .ES .nf \*(CDHost: \*(FCftp.gnu.org\*(FR -File: \*(FC/gnu/gawk/gawk-4.0.0.tar.gz\fP +File: \*(FC/gnu/gawk/gawk-4.1.1.tar.gz\fP .in +.2i .fi GNU \*(AK (\*(GK). There may be a later version. .in -.2i .nf .sp .4 -\*(FChttp://www.cs.princeton.edu/~bwk/btl.mirror/ -awk.tar.gz\fP +.\" http://www.cs.princeton.edu/~bwk/btl.mirror/ +.\" awk.tar.gz +.\" .br +\*(FCgit clone git://github.com/onetrueawk/awk\fP .in +.2i .fi \*(NK. This version requires an ANSI C compiler; @@ -1929,9 +1960,6 @@ GCC (the GNU Compiler Collection) works well. .in -.2i .nf .sp .4 -... Host: \*(FCftp.whidbey.net\*(FR -... File: \*(FC/pub/brennan/mawk1.3.3.tar.gz\fP -... \*(FChttp://www.skeeve.com/gawk/mawk1.3.3.tar.gz\fP Host: \*(FCinvisible-island.net\*(FR File: \*(FC/mawk/mawk.tar.gz\fP .in +.2i @@ -1939,13 +1967,13 @@ File: \*(FC/mawk/mawk.tar.gz\fP Michael Brennan's \*(MK. Thomas Dickey now maintains it.\*(CX .in -.2i -.EB "\s+2\f(HBFTP/HTTP INFORMATION\*(FR\s0" +.EB "\s+2\f(HBFTP/HTTP/GIT INFORMATION\*(FR\s0" .sp .5 .\" --- Copying Permissions .ES .fi -\*(CDCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -2007, 2009, 2010, 2011 Free Software Foundation, Inc. +\*(CDCopyright \(co 1996\(en2005, +2007, 2009\(en2014 Free Software Foundation, Inc. .sp .5 Permission is granted to make and distribute verbatim copies of this reference card provided the copyright notice and this permission notice |