|
Lines 21-30
Link Here
|
| 21 |
@c applies to, and when the document was updated. |
21 |
@c applies to, and when the document was updated. |
| 22 |
@set TITLE Effective AWK Programming |
22 |
@set TITLE Effective AWK Programming |
| 23 |
@set SUBTITLE A User's Guide for GNU Awk |
23 |
@set SUBTITLE A User's Guide for GNU Awk |
| 24 |
@set PATCHLEVEL 3 |
24 |
@set PATCHLEVEL 4 |
| 25 |
@set EDITION 1.0.@value{PATCHLEVEL} |
25 |
@set EDITION 1.0.@value{PATCHLEVEL} |
| 26 |
@set VERSION 3.0 |
26 |
@set VERSION 3.0 |
| 27 |
@set UPDATE-MONTH February 1997 |
27 |
@set UPDATE-MONTH April, 1999 |
| 28 |
@iftex |
28 |
@iftex |
| 29 |
@set DOCUMENT book |
29 |
@set DOCUMENT book |
| 30 |
@end iftex |
30 |
@end iftex |
|
Lines 74-80
Link Here
|
| 74 |
This is Edition @value{EDITION} of @cite{@value{TITLE}}, |
74 |
This is Edition @value{EDITION} of @cite{@value{TITLE}}, |
| 75 |
for the @value{VERSION}.@value{PATCHLEVEL} version of the GNU implementation of AWK. |
75 |
for the @value{VERSION}.@value{PATCHLEVEL} version of the GNU implementation of AWK. |
| 76 |
|
76 |
|
| 77 |
Copyright (C) 1989, 1991, 92, 93, 96, 97 Free Software Foundation, Inc. |
77 |
Copyright (C) 1989, 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc. |
| 78 |
|
78 |
|
| 79 |
Permission is granted to make and distribute verbatim copies of |
79 |
Permission is granted to make and distribute verbatim copies of |
| 80 |
this manual provided the copyright notice and this permission notice |
80 |
this manual provided the copyright notice and this permission notice |
|
Lines 138-144
Link Here
|
| 138 |
Registered Trademark of Paramount Pictures Corporation. @* |
138 |
Registered Trademark of Paramount Pictures Corporation. @* |
| 139 |
@c sorry, i couldn't resist |
139 |
@c sorry, i couldn't resist |
| 140 |
@sp 3 |
140 |
@sp 3 |
| 141 |
Copyright @copyright{} 1989, 1991, 92, 93, 96, 97 Free Software Foundation, Inc. |
141 |
Copyright @copyright{} 1989, 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc. |
| 142 |
@sp 2 |
142 |
@sp 2 |
| 143 |
|
143 |
|
| 144 |
This is Edition @value{EDITION} of @cite{@value{TITLE}}, @* |
144 |
This is Edition @value{EDITION} of @cite{@value{TITLE}}, @* |
|
Lines 153-168
Link Here
|
| 153 |
@item Seattle, WA 98155 USA @tab Boston, MA 02111-1307 USA |
153 |
@item Seattle, WA 98155 USA @tab Boston, MA 02111-1307 USA |
| 154 |
@item Phone: +1-206-782-7733 @tab Phone: +1-617-542-5942 |
154 |
@item Phone: +1-206-782-7733 @tab Phone: +1-617-542-5942 |
| 155 |
@item Fax: +1-206-782-7191 @tab Fax: +1-617-542-2652 |
155 |
@item Fax: +1-206-782-7191 @tab Fax: +1-617-542-2652 |
| 156 |
@item E-mail: @code{sales@@ssc.com} @tab E-mail: @code{gnu@@prep.ai.mit.edu} |
156 |
@item E-mail: @code{sales@@ssc.com} @tab E-mail: @code{gnu@@gnu.org} |
| 157 |
@item URL: @code{http://www.ssc.com/} @tab URL: @code{http://www.fsf.org/} |
157 |
@item URL: @code{http://www.ssc.com/} @tab URL: @code{http://www.fsf.org/} |
| 158 |
@end multitable |
158 |
@end multitable |
| 159 |
|
159 |
|
| 160 |
@sp 1 |
160 |
@sp 1 |
| 161 |
@c this ISBN can change! Check with SSC |
161 |
@c this ISBN can change! Check with SSC |
| 162 |
@c This one is correct for gawk 3.0 and edition 1.0 from the FSF |
162 |
@c This one is correct for gawk 3.0 and edition 1.0 from the FSF |
| 163 |
@c ISBN 1-882114-26-4 @* |
163 |
ISBN 1-882114-26-4 @* |
| 164 |
@c This one is correct for gawk 3.0.3 and edition 1.0.3 from SSC |
164 |
@c This one is correct for gawk 3.0.3 and edition 1.0.3 from SSC |
| 165 |
ISBN 1-57831-000-8 @* |
165 |
@c ISBN 1-57831-000-8 @* |
| 166 |
|
166 |
|
| 167 |
Permission is granted to make and distribute verbatim copies of |
167 |
Permission is granted to make and distribute verbatim copies of |
| 168 |
this manual provided the copyright notice and this permission notice |
168 |
this manual provided the copyright notice and this permission notice |
|
Lines 1387-1392
Link Here
|
| 1387 |
program which users can invoke without their having to know that the program is |
1387 |
program which users can invoke without their having to know that the program is |
| 1388 |
written in @code{awk}. |
1388 |
written in @code{awk}. |
| 1389 |
|
1389 |
|
|
|
1390 |
@strong{Caution:} You should not put more than one argument on the @samp{#!} |
| 1391 |
line after the path to @code{awk}. This will not work. The operating system |
| 1392 |
treats the rest of the line as a single agument, and passes it to @code{awk}. |
| 1393 |
Doing this will lead to confusing behavior: most likely a usage diagnostic |
| 1394 |
of some sort from @code{awk}. |
| 1395 |
|
| 1390 |
@cindex shell scripts |
1396 |
@cindex shell scripts |
| 1391 |
@cindex scripts, shell |
1397 |
@cindex scripts, shell |
| 1392 |
Some older systems do not support the @samp{#!} mechanism. You can get a |
1398 |
Some older systems do not support the @samp{#!} mechanism. You can get a |
|
Lines 1441-1446
Link Here
|
| 1441 |
comment is to help you or another person understand the program at |
1447 |
comment is to help you or another person understand the program at |
| 1442 |
a later time. |
1448 |
a later time. |
| 1443 |
|
1449 |
|
|
|
1450 |
@strong{Caution:} As mentioned in |
| 1451 |
@ref{One-shot, ,One-shot Throw-away @code{awk} Programs}, |
| 1452 |
you can enclose small to medium programs in single quotes, in order to keep |
| 1453 |
your shell scripts self-contained. When doing so, @emph{don't} put |
| 1454 |
an apostrophe (i.e., a single quote) into a comment (or anywhere else |
| 1455 |
in your program). The shell will interpret the quote as the closing |
| 1456 |
quote for the entire program. As a result, usually the shell will |
| 1457 |
print a message about mismatched quotes, and if @code{awk} actually |
| 1458 |
runs, it will probably print strange messages about syntax errors. |
| 1459 |
For example: |
| 1460 |
|
| 1461 |
@example |
| 1462 |
awk 'BEGIN @{ print "hello" @} # let's be cute' |
| 1463 |
@end example |
| 1464 |
|
| 1444 |
@node Very Simple, Two Rules, Running gawk, Getting Started |
1465 |
@node Very Simple, Two Rules, Running gawk, Getting Started |
| 1445 |
@section A Very Simple Example |
1466 |
@section A Very Simple Example |
| 1446 |
|
1467 |
|
|
Lines 2142-2148
Link Here
|
| 2142 |
Another interesting question arises. Suppose you use an octal or hexadecimal |
2163 |
Another interesting question arises. Suppose you use an octal or hexadecimal |
| 2143 |
escape to represent a regexp metacharacter |
2164 |
escape to represent a regexp metacharacter |
| 2144 |
(@pxref{Regexp Operators, , Regular Expression Operators}). |
2165 |
(@pxref{Regexp Operators, , Regular Expression Operators}). |
| 2145 |
Does @code{awk} treat the character as literal character, or as a regexp |
2166 |
Does @code{awk} treat the character as a literal character, or as a regexp |
| 2146 |
operator? |
2167 |
operator? |
| 2147 |
|
2168 |
|
| 2148 |
@cindex dark corner |
2169 |
@cindex dark corner |
|
Lines 4450-4455
Link Here
|
| 4450 |
because the concatenation operator is not parenthesized, and you should |
4471 |
because the concatenation operator is not parenthesized, and you should |
| 4451 |
write it as @samp{("echo " "date") | getline} if you want your program |
4472 |
write it as @samp{("echo " "date") | getline} if you want your program |
| 4452 |
to be portable to other @code{awk} implementations. |
4473 |
to be portable to other @code{awk} implementations. |
|
|
4474 |
(It happens that @code{gawk} gets it right, but you should not |
| 4475 |
rely on this. Parentheses make it easier to read, anyway.) |
| 4453 |
|
4476 |
|
| 4454 |
@node Getline/Variable/Pipe, Getline Summary, Getline/Pipe, Getline |
4477 |
@node Getline/Variable/Pipe, Getline Summary, Getline/Pipe, Getline |
| 4455 |
@subsection Using @code{getline} Into a Variable from a Pipe |
4478 |
@subsection Using @code{getline} Into a Variable from a Pipe |
|
Lines 4482-4487
Link Here
|
| 4482 |
because the concatenation operator is not parenthesized, and you should |
4505 |
because the concatenation operator is not parenthesized, and you should |
| 4483 |
write it as @samp{("echo " "date") | getline @var{var}} if you want your |
4506 |
write it as @samp{("echo " "date") | getline @var{var}} if you want your |
| 4484 |
program to be portable to other @code{awk} implementations. |
4507 |
program to be portable to other @code{awk} implementations. |
|
|
4508 |
(It happens that @code{gawk} gets it right, but you should not |
| 4509 |
rely on this. Parentheses make it easier to read, anyway.) |
| 4485 |
@end ifinfo |
4510 |
@end ifinfo |
| 4486 |
|
4511 |
|
| 4487 |
@node Getline Summary, , Getline/Variable/Pipe, Getline |
4512 |
@node Getline Summary, , Getline/Variable/Pipe, Getline |
|
Lines 4616-4622
Link Here
|
| 4616 |
|
4641 |
|
| 4617 |
Here is an example of printing a string that contains embedded newlines |
4642 |
Here is an example of printing a string that contains embedded newlines |
| 4618 |
(the @samp{\n} is an escape sequence, used to represent the newline |
4643 |
(the @samp{\n} is an escape sequence, used to represent the newline |
| 4619 |
character; see @ref{Escape Sequences}): |
4644 |
character; @pxref{Escape Sequences}): |
| 4620 |
|
4645 |
|
| 4621 |
@example |
4646 |
@example |
| 4622 |
@group |
4647 |
@group |
|
Lines 6975-6980
Link Here
|
| 6975 |
However, you cannot put a newline in front |
7000 |
However, you cannot put a newline in front |
| 6976 |
of either character without using backslash continuation |
7001 |
of either character without using backslash continuation |
| 6977 |
(@pxref{Statements/Lines, ,@code{awk} Statements Versus Lines}). |
7002 |
(@pxref{Statements/Lines, ,@code{awk} Statements Versus Lines}). |
|
|
7003 |
If @samp{--posix} is specified |
| 7004 |
(@pxref{Options, , Command Line Options}), then this extension is disabled. |
| 6978 |
|
7005 |
|
| 6979 |
@node Function Calls, Precedence, Conditional Exp, Expressions |
7006 |
@node Function Calls, Precedence, Conditional Exp, Expressions |
| 6980 |
@section Function Calls |
7007 |
@section Function Calls |
|
Lines 8264-8270
Link Here
|
| 8264 |
@example |
8291 |
@example |
| 8265 |
@group |
8292 |
@group |
| 8266 |
BEGIN @{ |
8293 |
BEGIN @{ |
| 8267 |
if (("date" | getline date_now) < 0) @{ |
8294 |
if (("date" | getline date_now) <= 0) @{ |
| 8268 |
print "Can't get system date" > "/dev/stderr" |
8295 |
print "Can't get system date" > "/dev/stderr" |
| 8269 |
exit 1 |
8296 |
exit 1 |
| 8270 |
@} |
8297 |
@} |
|
Lines 8627-8635
Link Here
|
| 8627 |
|
8654 |
|
| 8628 |
Notice that the @code{awk} program is not entered in @code{ARGV}. The |
8655 |
Notice that the @code{awk} program is not entered in @code{ARGV}. The |
| 8629 |
other special command line options, with their arguments, are also not |
8656 |
other special command line options, with their arguments, are also not |
| 8630 |
entered. But variable assignments on the command line @emph{are} |
8657 |
entered. This includes variable assignments done with the @samp{-v} |
|
|
8658 |
option (@pxref{Options, ,Command Line Options}). |
| 8659 |
Normal variable assignments on the command line @emph{are} |
| 8631 |
treated as arguments, and do show up in the @code{ARGV} array. |
8660 |
treated as arguments, and do show up in the @code{ARGV} array. |
| 8632 |
|
8661 |
|
|
|
8662 |
@example |
| 8663 |
$ cat showargs.awk |
| 8664 |
@print{} BEGIN @{ |
| 8665 |
@print{} printf "A=%d, B=%d\n", A, B |
| 8666 |
@print{} for (i = 0; i < ARGC; i++) |
| 8667 |
@print{} printf "\tARGV[%d] = %s\n", i, ARGV[i] |
| 8668 |
@print{} @} |
| 8669 |
@print{} END @{ printf "A=%d, B=%d\n", A, B @} |
| 8670 |
$ awk -v A=1 -f showargs.awk B=2 /dev/null |
| 8671 |
@print{} A=1, B=0 |
| 8672 |
@print{} ARGV[0] = awk |
| 8673 |
@print{} ARGV[1] = B=2 |
| 8674 |
@print{} ARGV[2] = /dev/null |
| 8675 |
@print{} A=1, B=2 |
| 8676 |
@end example |
| 8677 |
|
| 8633 |
Your program can alter @code{ARGC} and the elements of @code{ARGV}. |
8678 |
Your program can alter @code{ARGC} and the elements of @code{ARGV}. |
| 8634 |
Each time @code{awk} reaches the end of an input file, it uses the next |
8679 |
Each time @code{awk} reaches the end of an input file, it uses the next |
| 8635 |
element of @code{ARGV} as the name of the next input file. By storing a |
8680 |
element of @code{ARGV} as the name of the next input file. By storing a |
|
Lines 9172-9177
Link Here
|
| 9172 |
apart the null string. Since there is no data to split out, the |
9217 |
apart the null string. Since there is no data to split out, the |
| 9173 |
function simply clears the array and then returns. |
9218 |
function simply clears the array and then returns. |
| 9174 |
|
9219 |
|
|
|
9220 |
@strong{Caution:} Deleting an array does not change its type; you cannot |
| 9221 |
delete an array and then use the array's name as a scalar. For |
| 9222 |
example, this will not work: |
| 9223 |
|
| 9224 |
@example |
| 9225 |
a[1] = 3; delete a; a = 3 |
| 9226 |
@end example |
| 9227 |
|
| 9175 |
@node Numeric Array Subscripts, Uninitialized Subscripts, Delete, Arrays |
9228 |
@node Numeric Array Subscripts, Uninitialized Subscripts, Delete, Arrays |
| 9176 |
@section Using Numbers to Subscript Arrays |
9229 |
@section Using Numbers to Subscript Arrays |
| 9177 |
|
9230 |
|
|
Lines 9785-9790
Link Here
|
| 9785 |
Before splitting the string, @code{split} deletes any previously existing |
9838 |
Before splitting the string, @code{split} deletes any previously existing |
| 9786 |
elements in the array @var{array} (d.c.). |
9839 |
elements in the array @var{array} (d.c.). |
| 9787 |
|
9840 |
|
|
|
9841 |
If @var{string} does not match @var{fieldsep} at all, @var{array} will have |
| 9842 |
one element. The value of that element will be the original |
| 9843 |
@var{string}. |
| 9844 |
|
| 9788 |
@item sprintf(@var{format}, @var{expression1},@dots{}) |
9845 |
@item sprintf(@var{format}, @var{expression1},@dots{}) |
| 9789 |
@findex sprintf |
9846 |
@findex sprintf |
| 9790 |
This returns (without printing) the string that @code{printf} would |
9847 |
This returns (without printing) the string that @code{printf} would |
|
Lines 9901-9906
Link Here
|
| 9901 |
object as the third parameter will cause a fatal error, and your program |
9958 |
object as the third parameter will cause a fatal error, and your program |
| 9902 |
will not run. |
9959 |
will not run. |
| 9903 |
|
9960 |
|
|
|
9961 |
Finally, if the @var{regexp} is not a regexp constant, it is converted into a |
| 9962 |
string and then the value of that string is treated as the regexp to match. |
| 9963 |
|
| 9904 |
@item gsub(@var{regexp}, @var{replacement} @r{[}, @var{target}@r{]}) |
9964 |
@item gsub(@var{regexp}, @var{replacement} @r{[}, @var{target}@r{]}) |
| 9905 |
@findex gsub |
9965 |
@findex gsub |
| 9906 |
This is similar to the @code{sub} function, except @code{gsub} replaces |
9966 |
This is similar to the @code{sub} function, except @code{gsub} replaces |
|
Lines 9980-9985
Link Here
|
| 9980 |
@samp{G}, or if it is a number that is less than zero, only one |
10040 |
@samp{G}, or if it is a number that is less than zero, only one |
| 9981 |
substitution is performed. |
10041 |
substitution is performed. |
| 9982 |
|
10042 |
|
|
|
10043 |
If @var{regexp} does not match @var{target}, @code{gensub}'s return value |
| 10044 |
is the original, unchanged value of @var{target}. |
| 10045 |
|
| 9983 |
@cindex differences between @code{gawk} and @code{awk} |
10046 |
@cindex differences between @code{gawk} and @code{awk} |
| 9984 |
@code{gensub} is a @code{gawk} extension; it is not available |
10047 |
@code{gensub} is a @code{gawk} extension; it is not available |
| 9985 |
in compatibility mode (@pxref{Options, ,Command Line Options}). |
10048 |
in compatibility mode (@pxref{Options, ,Command Line Options}). |
|
Lines 10310-10316
Link Here
|
| 10310 |
@item system(@var{command}) |
10373 |
@item system(@var{command}) |
| 10311 |
@findex system |
10374 |
@findex system |
| 10312 |
@cindex interaction, @code{awk} and other programs |
10375 |
@cindex interaction, @code{awk} and other programs |
| 10313 |
The system function allows the user to execute operating system commands |
10376 |
The @code{system} function allows the user to execute operating system commands |
| 10314 |
and then return to the @code{awk} program. The @code{system} function |
10377 |
and then return to the @code{awk} program. The @code{system} function |
| 10315 |
executes the command given by the string @var{command}. It returns, as |
10378 |
executes the command given by the string @var{command}. It returns, as |
| 10316 |
its value, the status returned by the command that was executed. |
10379 |
its value, the status returned by the command that was executed. |
|
Lines 10329-10335
Link Here
|
| 10329 |
finishes processing input and begins its end-of-input processing. |
10392 |
finishes processing input and begins its end-of-input processing. |
| 10330 |
|
10393 |
|
| 10331 |
Note that redirecting @code{print} or @code{printf} into a pipe is often |
10394 |
Note that redirecting @code{print} or @code{printf} into a pipe is often |
| 10332 |
enough to accomplish your task. However, if your @code{awk} |
10395 |
enough to accomplish your task. If you need to run many commands, it |
|
|
10396 |
will be more efficient to simply print them to a pipe to the shell: |
| 10397 |
|
| 10398 |
@example |
| 10399 |
while (@var{more stuff to do}) |
| 10400 |
print @var{command} | "/bin/sh" |
| 10401 |
close("/bin/sh") |
| 10402 |
@end example |
| 10403 |
|
| 10404 |
@noindent |
| 10405 |
However, if your @code{awk} |
| 10333 |
program is interactive, @code{system} is useful for cranking up large |
10406 |
program is interactive, @code{system} is useful for cranking up large |
| 10334 |
self-contained programs, such as a shell or an editor. |
10407 |
self-contained programs, such as a shell or an editor. |
| 10335 |
|
10408 |
|
|
Lines 11889-11895
Link Here
|
| 11889 |
@c file eg/lib/nextfile.awk |
11962 |
@c file eg/lib/nextfile.awk |
| 11890 |
# nextfile --- skip remaining records in current file |
11963 |
# nextfile --- skip remaining records in current file |
| 11891 |
# correctly handle successive occurrences of the same file |
11964 |
# correctly handle successive occurrences of the same file |
| 11892 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
11965 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 11893 |
# May, 1993 |
11966 |
# May, 1993 |
| 11894 |
|
11967 |
|
| 11895 |
# this should be read in before the "main" awk program |
11968 |
# this should be read in before the "main" awk program |
|
Lines 11983-11989
Link Here
|
| 11983 |
@c @group |
12056 |
@c @group |
| 11984 |
@c file eg/lib/assert.awk |
12057 |
@c file eg/lib/assert.awk |
| 11985 |
# assert --- assert that a condition is true. Otherwise exit. |
12058 |
# assert --- assert that a condition is true. Otherwise exit. |
| 11986 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
12059 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 11987 |
# May, 1993 |
12060 |
# May, 1993 |
| 11988 |
|
12061 |
|
| 11989 |
function assert(condition, string) |
12062 |
function assert(condition, string) |
|
Lines 12038-12044
Link Here
|
| 12038 |
@end example |
12111 |
@end example |
| 12039 |
|
12112 |
|
| 12040 |
There is a problem with this version of @code{assert}, that it may not |
12113 |
There is a problem with this version of @code{assert}, that it may not |
| 12041 |
be possible to work around. An @code{END} rule is automatically added |
12114 |
be possible to work around with standard @code{awk}. |
|
|
12115 |
An @code{END} rule is automatically added |
| 12042 |
to the program calling @code{assert}. Normally, if a program consists |
12116 |
to the program calling @code{assert}. Normally, if a program consists |
| 12043 |
of just a @code{BEGIN} rule, the input files and/or standard input are |
12117 |
of just a @code{BEGIN} rule, the input files and/or standard input are |
| 12044 |
not read. However, now that the program has an @code{END} rule, @code{awk} |
12118 |
not read. However, now that the program has an @code{END} rule, @code{awk} |
|
Lines 12069-12075
Link Here
|
| 12069 |
@c file eg/lib/round.awk |
12143 |
@c file eg/lib/round.awk |
| 12070 |
# round --- do normal rounding |
12144 |
# round --- do normal rounding |
| 12071 |
# |
12145 |
# |
| 12072 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, August, 1996 |
12146 |
# Arnold Robbins, arnold@@gnu.org, August, 1996 |
| 12073 |
# Public Domain |
12147 |
# Public Domain |
| 12074 |
|
12148 |
|
| 12075 |
function round(x, ival, aval, fraction) |
12149 |
function round(x, ival, aval, fraction) |
|
Lines 12130-12136
Link Here
|
| 12130 |
# _ord_init: function to initialize _ord_ |
12204 |
# _ord_init: function to initialize _ord_ |
| 12131 |
# |
12205 |
# |
| 12132 |
# Arnold Robbins |
12206 |
# Arnold Robbins |
| 12133 |
# arnold@@gnu.ai.mit.edu |
12207 |
# arnold@@gnu.org |
| 12134 |
# Public Domain |
12208 |
# Public Domain |
| 12135 |
# 16 January, 1992 |
12209 |
# 16 January, 1992 |
| 12136 |
# 20 July, 1992, revised |
12210 |
# 20 July, 1992, revised |
|
Lines 12254-12260
Link Here
|
| 12254 |
@group |
12328 |
@group |
| 12255 |
@c file eg/lib/join.awk |
12329 |
@c file eg/lib/join.awk |
| 12256 |
# join.awk --- join an array into a string |
12330 |
# join.awk --- join an array into a string |
| 12257 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
12331 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 12258 |
# May 1993 |
12332 |
# May 1993 |
| 12259 |
|
12333 |
|
| 12260 |
function join(array, start, end, sep, result, i) |
12334 |
function join(array, start, end, sep, result, i) |
|
Lines 12329-12335
Link Here
|
| 12329 |
@c file eg/lib/mktime.awk |
12403 |
@c file eg/lib/mktime.awk |
| 12330 |
# mktime.awk --- convert a canonical date representation |
12404 |
# mktime.awk --- convert a canonical date representation |
| 12331 |
# into a timestamp |
12405 |
# into a timestamp |
| 12332 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
12406 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 12333 |
# May 1993 |
12407 |
# May 1993 |
| 12334 |
|
12408 |
|
| 12335 |
BEGIN \ |
12409 |
BEGIN \ |
|
Lines 12624-12630
Link Here
|
| 12624 |
@c @group |
12698 |
@c @group |
| 12625 |
@c file eg/lib/gettime.awk |
12699 |
@c file eg/lib/gettime.awk |
| 12626 |
# gettimeofday --- get the time of day in a usable format |
12700 |
# gettimeofday --- get the time of day in a usable format |
| 12627 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain, May 1993 |
12701 |
# Arnold Robbins, arnold@@gnu.org, Public Domain, May 1993 |
| 12628 |
# |
12702 |
# |
| 12629 |
# Returns a string in the format of output of date(1) |
12703 |
# Returns a string in the format of output of date(1) |
| 12630 |
# Populates the array argument time with individual values: |
12704 |
# Populates the array argument time with individual values: |
|
Lines 12732-12738
Link Here
|
| 12732 |
# that each take the name of the file being started or |
12806 |
# that each take the name of the file being started or |
| 12733 |
# finished, respectively. |
12807 |
# finished, respectively. |
| 12734 |
# |
12808 |
# |
| 12735 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, January 1992 |
12809 |
# Arnold Robbins, arnold@@gnu.org, January 1992 |
| 12736 |
# Public Domain |
12810 |
# Public Domain |
| 12737 |
|
12811 |
|
| 12738 |
FILENAME != _oldfilename \ |
12812 |
FILENAME != _oldfilename \ |
|
Lines 12784-12790
Link Here
|
| 12784 |
# |
12858 |
# |
| 12785 |
# user supplies beginfile() and endfile() functions |
12859 |
# user supplies beginfile() and endfile() functions |
| 12786 |
# |
12860 |
# |
| 12787 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu. November 1992 |
12861 |
# Arnold Robbins, arnold@@gnu.org, November 1992 |
| 12788 |
# Public Domain |
12862 |
# Public Domain |
| 12789 |
|
12863 |
|
| 12790 |
FNR == 1 @{ |
12864 |
FNR == 1 @{ |
|
Lines 12929-12935
Link Here
|
| 12929 |
@c file eg/lib/getopt.awk |
13003 |
@c file eg/lib/getopt.awk |
| 12930 |
# getopt --- do C library getopt(3) function in awk |
13004 |
# getopt --- do C library getopt(3) function in awk |
| 12931 |
# |
13005 |
# |
| 12932 |
# arnold@@gnu.ai.mit.edu |
13006 |
# arnold@@gnu.org |
| 12933 |
# Public domain |
13007 |
# Public domain |
| 12934 |
# |
13008 |
# |
| 12935 |
# Initial version: March, 1991 |
13009 |
# Initial version: March, 1991 |
|
Lines 13206-13212
Link Here
|
| 13206 |
* Generate a printable version of the password database |
13280 |
* Generate a printable version of the password database |
| 13207 |
* |
13281 |
* |
| 13208 |
* Arnold Robbins |
13282 |
* Arnold Robbins |
| 13209 |
* arnold@@gnu.ai.mit.edu |
13283 |
* arnold@@gnu.org |
| 13210 |
* May 1993 |
13284 |
* May 1993 |
| 13211 |
* Public Domain |
13285 |
* Public Domain |
| 13212 |
*/ |
13286 |
*/ |
|
Lines 13289-13295
Link Here
|
| 13289 |
@c file eg/lib/passwdawk.in |
13363 |
@c file eg/lib/passwdawk.in |
| 13290 |
@group |
13364 |
@group |
| 13291 |
# passwd.awk --- access password file information |
13365 |
# passwd.awk --- access password file information |
| 13292 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
13366 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 13293 |
# May 1993 |
13367 |
# May 1993 |
| 13294 |
|
13368 |
|
| 13295 |
BEGIN @{ |
13369 |
BEGIN @{ |
|
Lines 13477-13483
Link Here
|
| 13477 |
* |
13551 |
* |
| 13478 |
* Generate a printable version of the group database |
13552 |
* Generate a printable version of the group database |
| 13479 |
* |
13553 |
* |
| 13480 |
* Arnold Robbins, arnold@@gnu.ai.mit.edu |
13554 |
* Arnold Robbins, arnold@@gnu.org |
| 13481 |
* May 1993 |
13555 |
* May 1993 |
| 13482 |
* Public Domain |
13556 |
* Public Domain |
| 13483 |
*/ |
13557 |
*/ |
|
Lines 13558-13564
Link Here
|
| 13558 |
@group |
13632 |
@group |
| 13559 |
@c file eg/lib/groupawk.in |
13633 |
@c file eg/lib/groupawk.in |
| 13560 |
# group.awk --- functions for dealing with the group file |
13634 |
# group.awk --- functions for dealing with the group file |
| 13561 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
13635 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 13562 |
# May 1993 |
13636 |
# May 1993 |
| 13563 |
|
13637 |
|
| 13564 |
BEGIN \ |
13638 |
BEGIN \ |
|
Lines 13725-13731
Link Here
|
| 13725 |
function getgrent() |
13799 |
function getgrent() |
| 13726 |
@{ |
13800 |
@{ |
| 13727 |
_gr_init() |
13801 |
_gr_init() |
| 13728 |
if (++gr_count in _gr_bycount) |
13802 |
if (++_gr_count in _gr_bycount) |
| 13729 |
return _gr_bycount[_gr_count] |
13803 |
return _gr_bycount[_gr_count] |
| 13730 |
return "" |
13804 |
return "" |
| 13731 |
@} |
13805 |
@} |
|
Lines 13947-13953
Link Here
|
| 13947 |
@c @group |
14021 |
@c @group |
| 13948 |
@c file eg/prog/cut.awk |
14022 |
@c file eg/prog/cut.awk |
| 13949 |
# cut.awk --- implement cut in awk |
14023 |
# cut.awk --- implement cut in awk |
| 13950 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
14024 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 13951 |
# May 1993 |
14025 |
# May 1993 |
| 13952 |
|
14026 |
|
| 13953 |
# Options: |
14027 |
# Options: |
|
Lines 14275-14281
Link Here
|
| 14275 |
@c @group |
14349 |
@c @group |
| 14276 |
@c file eg/prog/egrep.awk |
14350 |
@c file eg/prog/egrep.awk |
| 14277 |
# egrep.awk --- simulate egrep in awk |
14351 |
# egrep.awk --- simulate egrep in awk |
| 14278 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
14352 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 14279 |
# May 1993 |
14353 |
# May 1993 |
| 14280 |
|
14354 |
|
| 14281 |
# Options: |
14355 |
# Options: |
|
Lines 14558-14564
Link Here
|
| 14558 |
@c @group |
14632 |
@c @group |
| 14559 |
@c file eg/prog/id.awk |
14633 |
@c file eg/prog/id.awk |
| 14560 |
# id.awk --- implement id in awk |
14634 |
# id.awk --- implement id in awk |
| 14561 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
14635 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 14562 |
# May 1993 |
14636 |
# May 1993 |
| 14563 |
|
14637 |
|
| 14564 |
# output is: |
14638 |
# output is: |
|
Lines 14670-14676
Link Here
|
| 14670 |
@c @group |
14744 |
@c @group |
| 14671 |
@c file eg/prog/split.awk |
14745 |
@c file eg/prog/split.awk |
| 14672 |
# split.awk --- do split in awk |
14746 |
# split.awk --- do split in awk |
| 14673 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
14747 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 14674 |
# May 1993 |
14748 |
# May 1993 |
| 14675 |
|
14749 |
|
| 14676 |
# usage: split [-num] [file] [outname] |
14750 |
# usage: split [-num] [file] [outname] |
|
Lines 14798-14804
Link Here
|
| 14798 |
@group |
14872 |
@group |
| 14799 |
@c file eg/prog/tee.awk |
14873 |
@c file eg/prog/tee.awk |
| 14800 |
# tee.awk --- tee in awk |
14874 |
# tee.awk --- tee in awk |
| 14801 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
14875 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 14802 |
# May 1993 |
14876 |
# May 1993 |
| 14803 |
# Revised December 1995 |
14877 |
# Revised December 1995 |
| 14804 |
@end group |
14878 |
@end group |
|
Lines 14961-14967
Link Here
|
| 14961 |
@c @group |
15035 |
@c @group |
| 14962 |
@c file eg/prog/uniq.awk |
15036 |
@c file eg/prog/uniq.awk |
| 14963 |
# uniq.awk --- do uniq in awk |
15037 |
# uniq.awk --- do uniq in awk |
| 14964 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
15038 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 14965 |
# May 1993 |
15039 |
# May 1993 |
| 14966 |
|
15040 |
|
| 14967 |
@group |
15041 |
@group |
|
Lines 15197-15203
Link Here
|
| 15197 |
@c @group |
15271 |
@c @group |
| 15198 |
@c file eg/prog/wc.awk |
15272 |
@c file eg/prog/wc.awk |
| 15199 |
# wc.awk --- count lines, words, characters |
15273 |
# wc.awk --- count lines, words, characters |
| 15200 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
15274 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 15201 |
# May 1993 |
15275 |
# May 1993 |
| 15202 |
|
15276 |
|
| 15203 |
# Options: |
15277 |
# Options: |
|
Lines 15354-15360
Link Here
|
| 15354 |
@group |
15428 |
@group |
| 15355 |
@c file eg/prog/dupword.awk |
15429 |
@c file eg/prog/dupword.awk |
| 15356 |
# dupword --- find duplicate words in text |
15430 |
# dupword --- find duplicate words in text |
| 15357 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
15431 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 15358 |
# December 1991 |
15432 |
# December 1991 |
| 15359 |
|
15433 |
|
| 15360 |
@{ |
15434 |
@{ |
|
Lines 15398-15404
Link Here
|
| 15398 |
@c @group |
15472 |
@c @group |
| 15399 |
@c file eg/prog/alarm.awk |
15473 |
@c file eg/prog/alarm.awk |
| 15400 |
# alarm --- set an alarm |
15474 |
# alarm --- set an alarm |
| 15401 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
15475 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 15402 |
# May 1993 |
15476 |
# May 1993 |
| 15403 |
|
15477 |
|
| 15404 |
# usage: alarm time [ "message" [ count [ delay ] ] ] |
15478 |
# usage: alarm time [ "message" [ count [ delay ] ] ] |
|
Lines 15585-15591
Link Here
|
| 15585 |
@c @group |
15659 |
@c @group |
| 15586 |
@c file eg/prog/translate.awk |
15660 |
@c file eg/prog/translate.awk |
| 15587 |
# translate --- do tr like stuff |
15661 |
# translate --- do tr like stuff |
| 15588 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
15662 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 15589 |
# August 1989 |
15663 |
# August 1989 |
| 15590 |
|
15664 |
|
| 15591 |
# bugs: does not handle things like: tr A-Z a-z, it has |
15665 |
# bugs: does not handle things like: tr A-Z a-z, it has |
|
Lines 15703-15709
Link Here
|
| 15703 |
@c @group |
15777 |
@c @group |
| 15704 |
@c file eg/prog/labels.awk |
15778 |
@c file eg/prog/labels.awk |
| 15705 |
# labels.awk |
15779 |
# labels.awk |
| 15706 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
15780 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 15707 |
# June 1992 |
15781 |
# June 1992 |
| 15708 |
|
15782 |
|
| 15709 |
# Program to print labels. Each label is 5 lines of data |
15783 |
# Program to print labels. Each label is 5 lines of data |
|
Lines 15919-15925
Link Here
|
| 15919 |
@group |
15993 |
@group |
| 15920 |
@c file eg/prog/histsort.awk |
15994 |
@c file eg/prog/histsort.awk |
| 15921 |
# histsort.awk --- compact a shell history file |
15995 |
# histsort.awk --- compact a shell history file |
| 15922 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
15996 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 15923 |
# May 1993 |
15997 |
# May 1993 |
| 15924 |
|
15998 |
|
| 15925 |
# Thanks to Byron Rakitzis for the general idea |
15999 |
# Thanks to Byron Rakitzis for the general idea |
|
Lines 16016-16021
Link Here
|
| 16016 |
@file{extract.awk} to extract the sample |
16090 |
@file{extract.awk} to extract the sample |
| 16017 |
programs and install many of them in a standard directory, where |
16091 |
programs and install many of them in a standard directory, where |
| 16018 |
@code{gawk} can find them. |
16092 |
@code{gawk} can find them. |
|
|
16093 |
The Texinfo file looks something like this: |
| 16094 |
|
| 16095 |
@example |
| 16096 |
@dots{} |
| 16097 |
This program has a @@code@{BEGIN@} block, |
| 16098 |
which prints a nice message: |
| 16099 |
|
| 16100 |
@@example |
| 16101 |
@@c file examples/messages.awk |
| 16102 |
BEGIN @@@{ print "Don't panic!" @@@} |
| 16103 |
@@c end file |
| 16104 |
@@end example |
| 16105 |
|
| 16106 |
It also prints some final advice: |
| 16107 |
|
| 16108 |
@@example |
| 16109 |
@@c file examples/messages.awk |
| 16110 |
END @@@{ print "Always avoid bored archeologists!" @@@} |
| 16111 |
@@c end file |
| 16112 |
@@end example |
| 16113 |
@dots{} |
| 16114 |
@end example |
| 16019 |
|
16115 |
|
| 16020 |
@file{extract.awk} begins by setting @code{IGNORECASE} to one, so that |
16116 |
@file{extract.awk} begins by setting @code{IGNORECASE} to one, so that |
| 16021 |
mixed upper-case and lower-case letters in the directives won't matter. |
16117 |
mixed upper-case and lower-case letters in the directives won't matter. |
|
Lines 16030-16036
Link Here
|
| 16030 |
@c file eg/prog/extract.awk |
16126 |
@c file eg/prog/extract.awk |
| 16031 |
# extract.awk --- extract files and run programs |
16127 |
# extract.awk --- extract files and run programs |
| 16032 |
# from texinfo files |
16128 |
# from texinfo files |
| 16033 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
16129 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 16034 |
# May 1993 |
16130 |
# May 1993 |
| 16035 |
|
16131 |
|
| 16036 |
BEGIN @{ IGNORECASE = 1 @} |
16132 |
BEGIN @{ IGNORECASE = 1 @} |
|
Lines 16080-16085
Link Here
|
| 16080 |
the loop. |
16176 |
the loop. |
| 16081 |
If the line is an @samp{@@group} or @samp{@@end group} line, then it |
16177 |
If the line is an @samp{@@group} or @samp{@@end group} line, then it |
| 16082 |
ignores it, and goes on to the next line. |
16178 |
ignores it, and goes on to the next line. |
|
|
16179 |
(These Texinfo control lines keep blocks of code together on one page; |
| 16180 |
unfortunately, @TeX{} isn't always smart enough to do things exactly right, |
| 16181 |
and we have to give it some advice.) |
| 16083 |
|
16182 |
|
| 16084 |
Most of the work is in the following few lines. If the line has no @samp{@@} |
16183 |
Most of the work is in the following few lines. If the line has no @samp{@@} |
| 16085 |
symbols, it can be printed directly. Otherwise, each leading @samp{@@} must be |
16184 |
symbols, it can be printed directly. Otherwise, each leading @samp{@@} must be |
|
Lines 16213-16219
Link Here
|
| 16213 |
# awksed.awk --- do s/foo/bar/g using just print |
16312 |
# awksed.awk --- do s/foo/bar/g using just print |
| 16214 |
# Thanks to Michael Brennan for the idea |
16313 |
# Thanks to Michael Brennan for the idea |
| 16215 |
|
16314 |
|
| 16216 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
16315 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 16217 |
# August 1995 |
16316 |
# August 1995 |
| 16218 |
|
16317 |
|
| 16219 |
@group |
16318 |
@group |
|
Lines 16447-16453
Link Here
|
| 16447 |
#! /bin/sh |
16546 |
#! /bin/sh |
| 16448 |
|
16547 |
|
| 16449 |
# igawk --- like gawk but do @@include processing |
16548 |
# igawk --- like gawk but do @@include processing |
| 16450 |
# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain |
16549 |
# Arnold Robbins, arnold@@gnu.org, Public Domain |
| 16451 |
# July 1993 |
16550 |
# July 1993 |
| 16452 |
|
16551 |
|
| 16453 |
if [ "$1" = debug ] |
16552 |
if [ "$1" = debug ] |
|
Lines 18493-18499
Link Here
|
| 18493 |
Boston, MA 02111-1307 USA @* |
18592 |
Boston, MA 02111-1307 USA @* |
| 18494 |
Phone: +1-617-542-5942 @* |
18593 |
Phone: +1-617-542-5942 @* |
| 18495 |
Fax (including Japan): +1-617-542-2652 @* |
18594 |
Fax (including Japan): +1-617-542-2652 @* |
| 18496 |
E-mail: @code{gnu@@prep.ai.mit.edu} @* |
18595 |
E-mail: @code{gnu@@gnu.org} @* |
| 18497 |
@end quotation |
18596 |
@end quotation |
| 18498 |
|
18597 |
|
| 18499 |
@noindent |
18598 |
@noindent |
|
Lines 18502-18508
Link Here
|
| 18502 |
|
18601 |
|
| 18503 |
@item |
18602 |
@item |
| 18504 |
You can get @code{gawk} by using anonymous @code{ftp} to the Internet host |
18603 |
You can get @code{gawk} by using anonymous @code{ftp} to the Internet host |
| 18505 |
@code{ftp.gnu.ai.mit.edu}, in the directory @file{/pub/gnu}. |
18604 |
@code{gnudist.gnu.org}, in the directory @file{/gnu/gawk}. |
| 18506 |
|
18605 |
|
| 18507 |
Here is a list of alternate @code{ftp} sites from which you can obtain GNU |
18606 |
Here is a list of alternate @code{ftp} sites from which you can obtain GNU |
| 18508 |
software. When a site is listed as ``@var{site}@code{:}@var{directory}'' the |
18607 |
software. When a site is listed as ``@var{site}@code{:}@var{directory}'' the |
|
Lines 19318-19334
Link Here
|
| 19318 |
|
19417 |
|
| 19319 |
@table @asis |
19418 |
@table @asis |
| 19320 |
@item Internet: |
19419 |
@item Internet: |
| 19321 |
@samp{bug-gnu-utils@@prep.ai.mit.edu} |
19420 |
@samp{bug-gnu-utils@@gnu.org} |
| 19322 |
|
19421 |
|
| 19323 |
@item UUCP: |
19422 |
@item UUCP: |
| 19324 |
@samp{uunet!prep.ai.mit.edu!bug-gnu-utils} |
19423 |
@samp{uunet!gnu.org!bug-gnu-utils} |
| 19325 |
@end table |
19424 |
@end table |
| 19326 |
|
19425 |
|
| 19327 |
Please include the |
19426 |
Please include the |
| 19328 |
version number of @code{gawk} you are using. You can get this information |
19427 |
version number of @code{gawk} you are using. You can get this information |
| 19329 |
with the command @samp{gawk --version}. |
19428 |
with the command @samp{gawk --version}. |
| 19330 |
You should send a carbon copy of your mail to Arnold Robbins, who can |
19429 |
You should send a carbon copy of your mail to Arnold Robbins, who can |
| 19331 |
be reached at @samp{arnold@@gnu.ai.mit.edu}. |
19430 |
be reached at @samp{arnold@@gnu.org}. |
| 19332 |
|
19431 |
|
| 19333 |
@cindex @code{comp.lang.awk} |
19432 |
@cindex @code{comp.lang.awk} |
| 19334 |
@strong{Important!} Do @emph{not} try to report bugs in @code{gawk} by |
19433 |
@strong{Important!} Do @emph{not} try to report bugs in @code{gawk} by |
|
Lines 19408-19420
Link Here
|
| 19408 |
@item Unix @code{awk} |
19507 |
@item Unix @code{awk} |
| 19409 |
Brian Kernighan has been able to make his implementation of |
19508 |
Brian Kernighan has been able to make his implementation of |
| 19410 |
@code{awk} freely available. You can get it via anonymous @code{ftp} |
19509 |
@code{awk} freely available. You can get it via anonymous @code{ftp} |
| 19411 |
to the host @code{@w{netlib.att.com}}. Change directory to |
19510 |
to the host @code{@w{netlib.bell-labs.com}}. Change directory to |
| 19412 |
@file{/netlib/research}. Use ``binary'' or ``image'' mode, and |
19511 |
@file{/netlib/research}. Use ``binary'' or ``image'' mode, and |
| 19413 |
retrieve @file{awk.bundle.Z}. |
19512 |
retrieve @file{awk.bundle.gz}. |
|
|
19513 |
|
| 19514 |
This is a shell archive that has been compressed with the GNU @code{gzip} |
| 19515 |
utility. It can be uncompressed with the @code{gunzip} utility. |
| 19414 |
|
19516 |
|
| 19415 |
This is a shell archive that has been compressed with the @code{compress} |
19517 |
You can also retrieve this version via the World Wide Web from |
| 19416 |
utility. It can be uncompressed with either @code{uncompress} or the |
19518 |
@uref{http://cm.bell-labs.com/who/bwk, Brian Kernighan's home page}. |
| 19417 |
GNU @code{gunzip} utility. |
|
|
| 19418 |
|
19519 |
|
| 19419 |
This version requires an ANSI C compiler; GCC (the GNU C compiler) |
19520 |
This version requires an ANSI C compiler; GCC (the GNU C compiler) |
| 19420 |
works quite nicely. |
19521 |
works quite nicely. |
|
Lines 19496-19502
Link Here
|
| 19496 |
You are free to add any new features you like to @code{gawk}. |
19597 |
You are free to add any new features you like to @code{gawk}. |
| 19497 |
However, if you want your changes to be incorporated into the @code{gawk} |
19598 |
However, if you want your changes to be incorporated into the @code{gawk} |
| 19498 |
distribution, there are several steps that you need to take in order to |
19599 |
distribution, there are several steps that you need to take in order to |
| 19499 |
make it possible for me to include to your changes. |
19600 |
make it possible for me to include your changes. |
| 19500 |
|
19601 |
|
| 19501 |
@enumerate 1 |
19602 |
@enumerate 1 |
| 19502 |
@item |
19603 |
@item |
|
Lines 19598-19604
Link Here
|
| 19598 |
Both of these actions are easy to do, and @emph{many} people have done so |
19699 |
Both of these actions are easy to do, and @emph{many} people have done so |
| 19599 |
already. If you have questions, please contact me |
19700 |
already. If you have questions, please contact me |
| 19600 |
(@pxref{Bugs, , Reporting Problems and Bugs}), |
19701 |
(@pxref{Bugs, , Reporting Problems and Bugs}), |
| 19601 |
or @code{gnu@@prep.ai.mit.edu}. |
19702 |
or @code{gnu@@gnu.org}. |
| 19602 |
|
19703 |
|
| 19603 |
@item |
19704 |
@item |
| 19604 |
Update the documentation. |
19705 |
Update the documentation. |
|
Lines 19718-19724
Link Here
|
| 19718 |
@ifinfo |
19819 |
@ifinfo |
| 19719 |
Both of these actions are easy to do, and @emph{many} people have done so |
19820 |
Both of these actions are easy to do, and @emph{many} people have done so |
| 19720 |
already. If you have questions, please contact me, or |
19821 |
already. If you have questions, please contact me, or |
| 19721 |
@code{gnu@@prep.ai.mit.edu}. |
19822 |
@code{gnu@@gnu.org}. |
| 19722 |
@end ifinfo |
19823 |
@end ifinfo |
| 19723 |
@end enumerate |
19824 |
@end enumerate |
| 19724 |
|
19825 |
|
|
Lines 19855-19865
Link Here
|
| 19855 |
The GNU version of @code{malloc} could potentially speed up @code{gawk}, |
19956 |
The GNU version of @code{malloc} could potentially speed up @code{gawk}, |
| 19856 |
since it relies heavily on the use of dynamic memory allocation. |
19957 |
since it relies heavily on the use of dynamic memory allocation. |
| 19857 |
|
19958 |
|
| 19858 |
@item Use of the @code{rx} regexp library |
|
|
| 19859 |
The @code{rx} regular expression library could potentially speed up |
| 19860 |
all regexp operations that require knowing the exact location of matches. |
| 19861 |
This includes record termination, field and array splitting, |
| 19862 |
and the @code{sub}, @code{gsub}, @code{gensub} and @code{match} functions. |
| 19863 |
@end table |
19959 |
@end table |
| 19864 |
|
19960 |
|
| 19865 |
@node Improvements, , Future Extensions, Notes |
19961 |
@node Improvements, , Future Extensions, Notes |
|
Lines 20006-20012
Link Here
|
| 20006 |
A preprocessor for @code{pic} that reads descriptions of molecules |
20102 |
A preprocessor for @code{pic} that reads descriptions of molecules |
| 20007 |
and produces @code{pic} input for drawing them. It was written in @code{awk} |
20103 |
and produces @code{pic} input for drawing them. It was written in @code{awk} |
| 20008 |
by Brian Kernighan and Jon Bentley, and is available from |
20104 |
by Brian Kernighan and Jon Bentley, and is available from |
| 20009 |
@code{@w{netlib@@research.att.com}}. |
20105 |
@email{@w{netlib@@research.bell-labs.com}}. |
| 20010 |
|
20106 |
|
| 20011 |
@item Compound Statement |
20107 |
@item Compound Statement |
| 20012 |
A series of @code{awk} statements, enclosed in curly braces. Compound |
20108 |
A series of @code{awk} statements, enclosed in curly braces. Compound |