Annotation of src/usr.bin/awk/awk.1, Revision 1.17
1.17 ! jmc 1: .\" $OpenBSD: awk.1,v 1.16 2003/12/12 19:50:55 jmc Exp $
1.7 aaron 2: .\" EX/EE is a Bd
1.11 jmc 3: .\"
4: .\" Copyright (C) Lucent Technologies 1997
5: .\" All Rights Reserved
1.12 jmc 6: .\"
1.11 jmc 7: .\" Permission to use, copy, modify, and distribute this software and
8: .\" its documentation for any purpose and without fee is hereby
9: .\" granted, provided that the above copyright notice appear in all
10: .\" copies and that both that the copyright notice and this
11: .\" permission notice and warranty disclaimer appear in supporting
12: .\" documentation, and that the name Lucent Technologies or any of
13: .\" its entities not be used in advertising or publicity pertaining
14: .\" to distribution of the software without specific, written prior
15: .\" permission.
1.12 jmc 16: .\"
1.11 jmc 17: .\" LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18: .\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
19: .\" IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
20: .\" SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
22: .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
23: .\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
24: .\" THIS SOFTWARE.
25: .\"
1.7 aaron 26: .Dd June 29, 1996
27: .Dt AWK 1
28: .Os
29: .Sh NAME
30: .Nm awk
31: .Nd pattern-directed scanning and processing language
32: .Sh SYNOPSIS
33: .Nm awk
1.16 jmc 34: .Op Fl safe
35: .Op Fl V
36: .Op Fl d Ns Op Ar n
1.7 aaron 37: .Op Fl F Ar fs
1.16 jmc 38: .Oo Fl v Ar var Ns =
39: .Ns Ar value Oc
40: .Ar prog | Fl f Ar progfile
1.7 aaron 41: .Ar
42: .Nm nawk
43: .Ar ...
44: .Sh DESCRIPTION
45: .Nm
1.1 tholo 46: scans each input
1.7 aaron 47: .Ar file
1.1 tholo 48: for lines that match any of a set of patterns specified literally in
1.7 aaron 49: .Ar prog
1.16 jmc 50: or in one or more files specified as
1.7 aaron 51: .Fl f Ar progfile .
1.16 jmc 52: With each pattern there can be an associated action that will be performed
1.1 tholo 53: when a line of a
1.7 aaron 54: .Ar file
1.1 tholo 55: matches the pattern.
56: Each line is matched against the
57: pattern portion of every pattern-action statement;
58: the associated action is performed for each matched pattern.
1.6 aaron 59: The file name
1.16 jmc 60: .Sq -
1.1 tholo 61: means the standard input.
62: Any
1.7 aaron 63: .Ar file
1.1 tholo 64: of the form
1.16 jmc 65: .Ar var Ns = Ns Ar value
1.1 tholo 66: is treated as an assignment, not a filename,
67: and is executed at the time it would have been opened if it were a filename.
1.16 jmc 68: .Pp
69: The options are as follows:
70: .Bl -tag -width Ds
71: .It Fl d Ns Op Ar n
72: Debug mode.
73: Set debug level to
74: .Ar n ,
75: or 1 if
76: .Ar n
77: is not specified.
78: A value greater than 1 causes
79: .Nm
80: to dump core on fatal errors.
81: .It Fl F Ar fs
82: Define the input field separator to be the regular expression
1.7 aaron 83: .Ar fs .
1.16 jmc 84: .It Fl f Ar filename
85: Read program code from the specified file
86: .Ar filename
87: instead of from the command line.
88: .It Fl safe
89: Disable file output
1.17 ! jmc 90: .Pf ( Ic print No > ,
! 91: .Ic print No >> ) ,
1.7 aaron 92: process creation
93: .Po
1.17 ! jmc 94: .Ar cmd | Ic getline ,
! 95: .Ic print No \&| ,
! 96: .Ic system
1.7 aaron 97: .Pc
98: and access to the environment
1.17 ! jmc 99: .Pf ( Va ENVIRON ;
! 100: see
! 101: .Sx VARIABLES
! 102: below).
! 103: This is a first
1.16 jmc 104: .Pq and not very reliable
105: approximation to a
1.7 aaron 106: .Dq safe
107: version of
1.16 jmc 108: .Nm .
109: .It Fl V
110: Print the version number of
111: .Nm
112: to standard output and exit.
113: .It Fl v Ar var Ns = Ns Ar value
114: Assign
115: .Ar value
116: to variable
117: .Ar var
118: before
119: .Ar prog
120: is executed;
121: any number of
122: .Fl v
123: options may be present.
124: .El
1.7 aaron 125: .Pp
126: An input line is normally made up of fields separated by whitespace,
1.1 tholo 127: or by regular expression
1.7 aaron 128: .Va FS .
1.1 tholo 129: The fields are denoted
1.7 aaron 130: .Va $1 , $2 , ... ,
131: while
132: .Va $0
1.1 tholo 133: refers to the entire line.
134: If
1.7 aaron 135: .Va FS
1.1 tholo 136: is null, the input line is split into one field per character.
1.7 aaron 137: .Pp
1.1 tholo 138: A pattern-action statement has the form
1.7 aaron 139: .Pp
140: .D1 Ar pattern Ic \&{ Ar action Ic \&}
141: .Pp
1.6 aaron 142: A missing
1.7 aaron 143: .Ic \&{ Ar action Ic \&}
1.1 tholo 144: means print the line;
145: a missing pattern always matches.
146: Pattern-action statements are separated by newlines or semicolons.
1.7 aaron 147: .Pp
1.1 tholo 148: An action is a sequence of statements.
149: A statement can be one of the following:
1.7 aaron 150: .Bd -unfilled -offset indent
151: .Ic if ( Xo
152: .Ar expression ) statement \&
153: .Op Ic else Ar statement
154: .Xc
155: .Ic while ( Ar expression ) statement
156: .Ic for ( Xo
157: .Ar expression ; expression ; expression ) statement
158: .Xc
159: .Ic for ( Xo
160: .Ar var Ic in Ar array ) statement
161: .Xc
162: .Ic do Ar statement Ic while ( Ar expression )
163: .Ic break
164: .Ic continue
165: .Ic { Oo Ar statement ... Oc Ic \& }
166: .Ar expression Xo
167: .No "# commonly" \&
168: .Ar var Ic = Ar expression
169: .Xc
170: .Ic print Xo
171: .Op Ar expression-list
1.17 ! jmc 172: .Op > Ns Ar expression
1.7 aaron 173: .Xc
174: .Ic printf Ar format Xo
175: .Op Ar ... , expression-list
1.17 ! jmc 176: .Op > Ns Ar expression
1.7 aaron 177: .Xc
178: .Ic return Op Ar expression
179: .Ic next Xo
180: .No "# skip remaining patterns on this input line"
181: .Xc
182: .Ic nextfile Xo
183: .No "# skip rest of this file, open next, start at top"
184: .Xc
185: .Ic delete Ar array Ns Xo
186: .Ic \&[ Ns Ar expression Ns Ic \&]
187: .No \& "# delete an array element"
188: .Xc
189: .Ic delete Ar array Xo
190: .No "# delete all elements of array"
191: .Xc
192: .Ic exit Xo
193: .Op Ar expression
194: .No \& "# exit immediately; status is" Ar expression
195: .Xc
196: .Ed
197: .Pp
1.1 tholo 198: Statements are terminated by
199: semicolons, newlines or right braces.
200: An empty
1.7 aaron 201: .Ar expression-list
1.1 tholo 202: stands for
1.7 aaron 203: .Ar $0 .
204: String constants are quoted
205: .Li \&"" ,
1.1 tholo 206: with the usual C escapes recognized within.
207: Expressions take on string or numeric values as appropriate,
208: and are built using the operators
1.7 aaron 209: .Ic + \- * / % ^
210: (exponentiation), and concatenation (indicated by whitespace).
1.1 tholo 211: The operators
1.16 jmc 212: .Ic \&! ++ \-\- += \-= *= /= %= ^=
213: .Ic > >= < <= == != ?:
1.1 tholo 214: are also available in expressions.
215: Variables may be scalars, array elements
216: (denoted
1.7 aaron 217: .Li x[i] )
1.1 tholo 218: or fields.
219: Variables are initialized to the null string.
220: Array subscripts may be any string,
221: not necessarily numeric;
222: this allows for a form of associative memory.
223: Multiple subscripts such as
1.7 aaron 224: .Li [i,j,k]
1.1 tholo 225: are permitted; the constituents are concatenated,
226: separated by the value of
1.17 ! jmc 227: .Va SUBSEP
! 228: (see
! 229: .Sx VARIABLES
! 230: below).
1.7 aaron 231: .Pp
1.1 tholo 232: The
1.7 aaron 233: .Ic print
1.1 tholo 234: statement prints its arguments on the standard output
235: (or on a file if
1.17 ! jmc 236: .Pf > Ns Ar file
1.1 tholo 237: or
1.17 ! jmc 238: .Pf >> Ns Ar file
1.1 tholo 239: is present or on a pipe if
1.17 ! jmc 240: .Pf |\ \& Ar cmd
1.1 tholo 241: is present), separated by the current output field separator,
242: and terminated by the output record separator.
1.7 aaron 243: .Ar file
1.1 tholo 244: and
1.7 aaron 245: .Ar cmd
1.1 tholo 246: may be literal names or parenthesized expressions;
247: identical string values in different statements denote
248: the same open file.
249: The
1.7 aaron 250: .Ic printf
1.1 tholo 251: statement formats its expression list according to the format
252: (see
1.10 pvalchev 253: .Xr printf 3 ) .
1.17 ! jmc 254: .Sh FUNCTIONS
! 255: The awk language has a variety of built-in functions:
! 256: arithmetic, string, input/output and general.
! 257: .Ss Arithmetic Functions
! 258: .Bl -tag -width "atan2(y, x)"
! 259: .It Fn atan2 y x
! 260: Return the arctangent of
! 261: .Fa y Ns / Ns Fa x
! 262: in radians.
! 263: .It Fn cos x
! 264: Return the cosine of
! 265: .Fa x ,
! 266: where
! 267: .Fa x
! 268: is in radians.
! 269: .It Fn exp x
! 270: Return the exponential of
! 271: .Fa x .
! 272: .It Fn int x
! 273: Return
! 274: .Fa x
! 275: truncated to an integer value.
! 276: .It Fn log x
! 277: Return the natural logarithm of
! 278: .Fa x .
1.7 aaron 279: .It Fn rand
1.17 ! jmc 280: Return a random number,
! 281: .Fa n ,
! 282: such that
! 283: .Sm off
! 284: .Pf 0 \*(Le Fa n No \*(Lt 1 .
! 285: .Sm on
! 286: .It Fn sin x
! 287: Return the sine of
! 288: .Fa x ,
! 289: where
! 290: .Fa x
! 291: is in radians.
! 292: .It Fn sqrt x
! 293: Return the square root of
! 294: .Fa x .
! 295: .It Fn srand expr
1.16 jmc 296: Sets seed for
1.7 aaron 297: .Fn rand
1.17 ! jmc 298: to
! 299: .Fa expr
1.1 tholo 300: and returns the previous seed.
1.17 ! jmc 301: If
! 302: .Fa expr
! 303: is omitted, the time of day is used instead.
! 304: .El
! 305: .Ss String Functions
! 306: .Bl -tag -width "split(s, a, fs)"
! 307: .It Fn gsub r t s
! 308: The same as
! 309: .Fn sub
! 310: except that all occurrences of the regular expression are replaced.
! 311: .Fn gsub
! 312: returns the number of replacements.
1.7 aaron 313: .It Fn index s t
1.16 jmc 314: The position in
1.7 aaron 315: .Fa s
1.1 tholo 316: where the string
1.7 aaron 317: .Fa t
1.1 tholo 318: occurs, or 0 if it does not.
1.17 ! jmc 319: .It Fn length s
! 320: The length of
! 321: .Fa s
! 322: taken as a string,
! 323: or of
! 324: .Va $0
! 325: if no argument is given.
1.7 aaron 326: .It Fn match s r
1.16 jmc 327: The position in
1.7 aaron 328: .Fa s
1.1 tholo 329: where the regular expression
1.7 aaron 330: .Fa r
1.1 tholo 331: occurs, or 0 if it does not.
1.17 ! jmc 332: The variable
1.7 aaron 333: .Va RSTART
1.17 ! jmc 334: is set to the starting position of the matched string
! 335: .Pq which is the same as the returned value
! 336: or zero if no match is found.
! 337: The variable
1.7 aaron 338: .Va RLENGTH
1.17 ! jmc 339: is set to the length of the matched string,
! 340: or \-1 if no match is found.
1.7 aaron 341: .It Fn split s a fs
1.16 jmc 342: Splits the string
1.7 aaron 343: .Fa s
1.1 tholo 344: into array elements
1.7 aaron 345: .Va a[1] , a[2] , ... , a[n]
1.1 tholo 346: and returns
1.7 aaron 347: .Va n .
1.1 tholo 348: The separation is done with the regular expression
1.7 aaron 349: .Ar fs
1.1 tholo 350: or with the field separator
1.7 aaron 351: .Va FS
1.1 tholo 352: if
1.7 aaron 353: .Ar fs
1.1 tholo 354: is not given.
355: An empty string as field separator splits the string
356: into one array element per character.
1.17 ! jmc 357: .It Fn sprintf fmt expr ...
! 358: The string resulting from formatting
! 359: .Fa expr , ...
! 360: according to the
! 361: .Xr printf 3
! 362: format
! 363: .Fa fmt .
1.7 aaron 364: .It Fn sub r t s
1.16 jmc 365: Substitutes
1.7 aaron 366: .Fa t
1.1 tholo 367: for the first occurrence of the regular expression
1.7 aaron 368: .Fa r
1.1 tholo 369: in the string
1.7 aaron 370: .Fa s .
1.1 tholo 371: If
1.7 aaron 372: .Fa s
1.1 tholo 373: is not given,
1.7 aaron 374: .Va $0
1.1 tholo 375: is used.
1.17 ! jmc 376: An ampersand
! 377: .Pq Sq &
! 378: in
! 379: .Fa t
! 380: is replaced in string
! 381: .Fa s
! 382: with regular expression
! 383: .Fa r .
! 384: A literal ampersand can be specified by preceding it with two backslashes
! 385: .Pq Sq \e\e .
! 386: A literal backslash can be specified by preceding it with another backslash
! 387: .Pq Sq \e\e .
1.7 aaron 388: .Fn sub
1.17 ! jmc 389: returns the number of replacements.
! 390: .It Fn substr s m n
! 391: Return at most the
! 392: .Fa n Ns -character
! 393: substring of
! 394: .Fa s
! 395: that begins at position
! 396: .Fa m
! 397: counted from 1.
! 398: If
! 399: .Fa n
! 400: is omitted, or if
! 401: .Fa n
! 402: specifies more characters than are left in the string,
! 403: the length of the substring is limited by the length of
! 404: .Fa s .
1.7 aaron 405: .It Fn tolower str
1.16 jmc 406: Returns a copy of
1.7 aaron 407: .Fa str
1.1 tholo 408: with all upper-case characters translated to their
409: corresponding lower-case equivalents.
1.7 aaron 410: .It Fn toupper str
1.16 jmc 411: Returns a copy of
1.7 aaron 412: .Fa str
1.1 tholo 413: with all lower-case characters translated to their
414: corresponding upper-case equivalents.
1.7 aaron 415: .El
1.17 ! jmc 416: .Ss Input/Output and General Functions
! 417: .Bl -tag -width "getline [var] < file"
! 418: .It Fn close expr
! 419: Closes the file or pipe
! 420: .Fa expr .
! 421: .Fa expr
! 422: should match the string that was used to open the file or pipe.
! 423: .It Ar cmd | Ic getline Op Va var
! 424: Read a record of input from a stream piped from the output of
! 425: .Ar cmd .
! 426: If
! 427: .Va var
! 428: is omitted, the variables
! 429: .Va $0
! 430: and
! 431: .Va NF
! 432: are set.
! 433: Otherwise
! 434: .Va var
! 435: is set.
! 436: If the stream is not open, it is opened.
! 437: As long as the stream remains open, subsequent calls
! 438: will read subsequent records from the stream.
! 439: The stream remains open until explicitly closed with a call to
! 440: .Fn close .
! 441: .It Fn fflush expr
! 442: Flushes any buffered output for the file or pipe
! 443: .Fa expr .
! 444: .Fa expr
! 445: should match the string that was used to open the file or pipe.
! 446: .It Ic getline
! 447: Sets
! 448: .Va $0
! 449: to the next input record from the current input file.
! 450: This form of
! 451: .Ic getline
! 452: sets the variables
! 453: .Va NF ,
! 454: .Va NR ,
! 455: and
! 456: .Va FNR .
1.7 aaron 457: .Ic getline
1.17 ! jmc 458: returns 1 for a successful input, 0 for end of file, and \-1 for an error.
! 459: .It Ic getline Va var
! 460: Sets
1.7 aaron 461: .Va $0
1.17 ! jmc 462: to variable
! 463: .Va var .
! 464: This form of
! 465: .Ic getline
! 466: sets the variables
! 467: .Va NR
! 468: and
! 469: .Va FNR .
! 470: .Ic getline
! 471: returns 1 for a successful input, 0 for end of file, and \-1 for an error.
! 472: .It Xo
! 473: .Ic getline Op Va var
! 474: .Pf \ \&< Ar file
! 475: .Xc
! 476: Sets
1.7 aaron 477: .Va $0
1.1 tholo 478: to the next record from
1.7 aaron 479: .Ar file .
1.17 ! jmc 480: If
! 481: .Va var
! 482: is omitted, the variables
! 483: .Va $0
! 484: and
! 485: .Va NF
! 486: are set.
! 487: Otherwise
! 488: .Va var
! 489: is set.
! 490: If
! 491: .Ar file
! 492: is not open, it is opened.
! 493: As long as the stream remains open, subsequent calls will read subsequent
! 494: records from
! 495: .Ar file .
! 496: .Ar file
! 497: remains open until explicitly closed with a call to
! 498: .Fn close .
! 499: .It Fn system cmd
! 500: Executes
! 501: .Fa cmd
! 502: and returns its exit status.
! 503: .El
! 504: .Pp
! 505: Functions may be defined (at the position of a pattern-action statement)
! 506: thusly:
! 507: .Pp
! 508: .Dl function foo(a, b, c) { ...; return x }
1.7 aaron 509: .Pp
1.17 ! jmc 510: Parameters are passed by value if scalar, and by reference if array name;
! 511: functions may be called recursively.
! 512: Parameters are local to the function; all other variables are global.
! 513: Thus local variables may be created by providing excess parameters in
! 514: the function definition.
! 515: .Sh PATTERNS
1.1 tholo 516: Patterns are arbitrary Boolean combinations
517: (with
1.14 jmc 518: .Ic "\&! || &&" )
1.1 tholo 519: of regular expressions and
520: relational expressions.
521: Regular expressions are as in
1.12 jmc 522: .Xr egrep 1 .
1.1 tholo 523: Isolated regular expressions
524: in a pattern apply to the entire line.
525: Regular expressions may also occur in
526: relational expressions, using the operators
1.7 aaron 527: .Ic ~
1.1 tholo 528: and
1.7 aaron 529: .Ic !~ .
1.17 ! jmc 530: .Pf / Ns Ar re Ns /
1.1 tholo 531: is a constant regular expression;
532: any string (constant or variable) may be used
533: as a regular expression, except in the position of an isolated regular expression
534: in a pattern.
1.7 aaron 535: .Pp
1.1 tholo 536: A pattern may consist of two patterns separated by a comma;
537: in this case, the action is performed for all lines
538: from an occurrence of the first pattern
1.15 jmc 539: through an occurrence of the second.
1.7 aaron 540: .Pp
1.1 tholo 541: A relational expression is one of the following:
1.7 aaron 542: .Bd -unfilled -offset indent
543: .Ar expression matchop regular-expression
544: .Ar expression relop expression
545: .Ar expression Ic in Ar array-name
546: .Ic \&( Ns Xo
547: .Ar expr , expr , \&... Ns Ic \&) in
548: .Ar \& array-name
549: .Xc
550: .Ed
1.15 jmc 551: .Pp
1.7 aaron 552: where a
553: .Ar relop
554: is any of the six relational operators in C, and a
555: .Ar matchop
556: is either
557: .Ic ~
1.1 tholo 558: (matches)
559: or
1.7 aaron 560: .Ic !~
1.1 tholo 561: (does not match).
562: A conditional is an arithmetic expression,
563: a relational expression,
564: or a Boolean combination
565: of these.
1.7 aaron 566: .Pp
1.1 tholo 567: The special patterns
1.7 aaron 568: .Ic BEGIN
1.1 tholo 569: and
1.7 aaron 570: .Ic END
1.1 tholo 571: may be used to capture control before the first input line is read
572: and after the last.
1.7 aaron 573: .Ic BEGIN
1.1 tholo 574: and
1.7 aaron 575: .Ic END
1.1 tholo 576: do not combine with other patterns.
1.17 ! jmc 577: .Sh VARIABLES
1.1 tholo 578: Variable names with special meanings:
1.7 aaron 579: .Pp
1.16 jmc 580: .Bl -tag -width "FILENAME" -compact
581: .It Va ARGC
582: Argument count, assignable.
583: .It Va ARGV
584: Argument array, assignable;
585: non-null members are taken as filenames.
1.7 aaron 586: .It Va CONVFMT
1.16 jmc 587: Conversion format used when converting numbers
1.3 millert 588: (default
1.16 jmc 589: .Qq Li %.6g ) .
590: .It Va ENVIRON
591: Array of environment variables; subscripts are names.
592: .It Va FILENAME
593: The name of the current input file.
594: .It Va FNR
595: Ordinal number of the current record in the current file.
1.7 aaron 596: .It Va FS
1.16 jmc 597: Regular expression used to separate fields; also settable
1.1 tholo 598: by option
1.9 millert 599: .Fl F Ar fs .
1.7 aaron 600: .It Va NF
1.16 jmc 601: Number of fields in the current record.
1.7 aaron 602: .It Va NR
1.16 jmc 603: Ordinal number of the current record.
604: .It Va OFMT
605: Output format for numbers (default
606: .Qq Li %.6g ) .
1.7 aaron 607: .It Va OFS
1.16 jmc 608: Output field separator (default blank).
1.7 aaron 609: .It Va ORS
1.16 jmc 610: Output record separator (default newline).
1.17 ! jmc 611: .It Va RLENGTH
! 612: The length of the string matched by the
! 613: .Fn match
! 614: function.
1.16 jmc 615: .It Va RS
616: Input record separator (default newline).
1.17 ! jmc 617: .It Va RSTART
! 618: The starting position of the string matched by the
! 619: .Fn match
! 620: function.
1.7 aaron 621: .It Va SUBSEP
1.16 jmc 622: Separates multiple subscripts (default 034).
1.7 aaron 623: .El
624: .Sh EXAMPLES
1.16 jmc 625: Print lines longer than 72 characters:
626: .Pp
1.7 aaron 627: .Dl length($0) > 72
1.16 jmc 628: .Pp
629: Print first two fields in opposite order:
1.7 aaron 630: .Pp
631: .Dl { print $2, $1 }
1.16 jmc 632: .Pp
633: Same, with input fields separated by comma and/or blanks and tabs:
1.7 aaron 634: .Bd -literal -offset indent
1.1 tholo 635: BEGIN { FS = ",[ \et]*|[ \et]+" }
636: { print $2, $1 }
1.7 aaron 637: .Ed
1.16 jmc 638: .Pp
639: Add up first column, print sum and average:
1.7 aaron 640: .Bd -literal -offset indent
641: { s += $1 }
642: END { print "sum is", s, " average is", s/NR }
643: .Ed
1.16 jmc 644: .Pp
645: Print all lines between start/stop pairs:
1.7 aaron 646: .Pp
647: .Dl /start/, /stop/
1.16 jmc 648: .Pp
649: Simulate echo(1):
1.7 aaron 650: .Bd -literal -offset indent
651: BEGIN { # Simulate echo(1)
652: for (i = 1; i < ARGC; i++) printf "%s ", ARGV[i]
653: printf "\en"
654: exit }
655: .Ed
656: .Sh SEE ALSO
1.16 jmc 657: .Xr egrep 1 ,
1.7 aaron 658: .Xr lex 1 ,
1.16 jmc 659: .Xr sed 1 ,
660: .Xr printf 3
1.7 aaron 661: .Rs
662: .%A A. V. Aho
663: .%A B. W. Kernighan
664: .%A P. J. Weinberger
665: .%T The AWK Programming Language
666: .%I Addison-Wesley
667: .%D 1988
668: .%O ISBN 0-201-07981-X
669: .Re
1.8 aaron 670: .Sh HISTORY
1.13 millert 671: An
1.8 aaron 672: .Nm
1.13 millert 673: utility appeared in
674: .At v7 .
1.7 aaron 675: .Sh BUGS
1.1 tholo 676: There are no explicit conversions between numbers and strings.
677: To force an expression to be treated as a number add 0 to it;
678: to force it to be treated as a string concatenate
1.7 aaron 679: .Li \&""
680: to it.
681: .Pp
1.1 tholo 682: The scope rules for variables in functions are a botch;
683: the syntax is worse.