3 e7c5e5ed 2009-08-18 mt4swm awk \- pattern-directed scanning and processing language
4 e7c5e5ed 2009-08-18 mt4swm .SH SYNOPSIS
26 e7c5e5ed 2009-08-18 mt4swm .I var=value
30 e7c5e5ed 2009-08-18 mt4swm .I progfile
35 e7c5e5ed 2009-08-18 mt4swm .I file ...
37 e7c5e5ed 2009-08-18 mt4swm .SH DESCRIPTION
39 e7c5e5ed 2009-08-18 mt4swm scans each input
41 e7c5e5ed 2009-08-18 mt4swm for lines that match any of a set of patterns specified literally in
43 e7c5e5ed 2009-08-18 mt4swm or in one or more files
44 e7c5e5ed 2009-08-18 mt4swm specified as
46 e7c5e5ed 2009-08-18 mt4swm .IR progfile .
47 e7c5e5ed 2009-08-18 mt4swm With each pattern
48 e7c5e5ed 2009-08-18 mt4swm there can be an associated action that will be performed
49 e7c5e5ed 2009-08-18 mt4swm when a line of a
51 e7c5e5ed 2009-08-18 mt4swm matches the pattern.
52 e7c5e5ed 2009-08-18 mt4swm Each line is matched against the
53 e7c5e5ed 2009-08-18 mt4swm pattern portion of every pattern-action statement;
54 e7c5e5ed 2009-08-18 mt4swm the associated action is performed for each matched pattern.
55 e7c5e5ed 2009-08-18 mt4swm The file name
57 e7c5e5ed 2009-08-18 mt4swm means the standard input.
60 e7c5e5ed 2009-08-18 mt4swm of the form
61 e7c5e5ed 2009-08-18 mt4swm .I var=value
62 e7c5e5ed 2009-08-18 mt4swm is treated as an assignment, not a file name,
63 e7c5e5ed 2009-08-18 mt4swm and is executed at the time it would have been opened if it were a file name.
64 e7c5e5ed 2009-08-18 mt4swm The option
66 e7c5e5ed 2009-08-18 mt4swm followed by
67 e7c5e5ed 2009-08-18 mt4swm .I var=value
68 e7c5e5ed 2009-08-18 mt4swm is an assignment to be done before the program
69 e7c5e5ed 2009-08-18 mt4swm is executed;
70 e7c5e5ed 2009-08-18 mt4swm any number of
72 e7c5e5ed 2009-08-18 mt4swm options may be present.
75 e7c5e5ed 2009-08-18 mt4swm option defines the input field separator to be the regular expression
78 e7c5e5ed 2009-08-18 mt4swm An input line is normally made up of fields separated by white space,
79 e7c5e5ed 2009-08-18 mt4swm or by regular expression
81 e7c5e5ed 2009-08-18 mt4swm The fields are denoted
84 e7c5e5ed 2009-08-18 mt4swm \&..., while
86 e7c5e5ed 2009-08-18 mt4swm refers to the entire line.
89 e7c5e5ed 2009-08-18 mt4swm is null, the input line is split into one field per character.
91 e7c5e5ed 2009-08-18 mt4swm To compensate for inadequate implementation of storage management,
94 e7c5e5ed 2009-08-18 mt4swm option can be used to set the maximum size of the input record,
97 e7c5e5ed 2009-08-18 mt4swm option to set the maximum number of fields.
101 e7c5e5ed 2009-08-18 mt4swm option causes
103 e7c5e5ed 2009-08-18 mt4swm to run in
104 e7c5e5ed 2009-08-18 mt4swm ``safe mode,''
105 e7c5e5ed 2009-08-18 mt4swm in which it is not allowed to
106 e7c5e5ed 2009-08-18 mt4swm run shell commands or open files
107 e7c5e5ed 2009-08-18 mt4swm and the environment is not made available
109 e7c5e5ed 2009-08-18 mt4swm .B ENVIRON
110 e7c5e5ed 2009-08-18 mt4swm variable.
112 e7c5e5ed 2009-08-18 mt4swm A pattern-action statement has the form
114 e7c5e5ed 2009-08-18 mt4swm .IB pattern " { " action " }
116 e7c5e5ed 2009-08-18 mt4swm A missing
117 e7c5e5ed 2009-08-18 mt4swm .BI { " action " }
118 e7c5e5ed 2009-08-18 mt4swm means print the line;
119 e7c5e5ed 2009-08-18 mt4swm a missing pattern always matches.
120 e7c5e5ed 2009-08-18 mt4swm Pattern-action statements are separated by newlines or semicolons.
122 e7c5e5ed 2009-08-18 mt4swm An action is a sequence of statements.
123 e7c5e5ed 2009-08-18 mt4swm A statement can be one of the following:
126 e7c5e5ed 2009-08-18 mt4swm .ta \w'\fLdelete array[expression]'u
127 e7c5e5ed 2009-08-18 mt4swm if(\fI expression \fP)\fI statement \fP\fR[ \fPelse\fI statement \fP\fR]\fP
128 e7c5e5ed 2009-08-18 mt4swm while(\fI expression \fP)\fI statement\fP
129 e7c5e5ed 2009-08-18 mt4swm for(\fI expression \fP;\fI expression \fP;\fI expression \fP)\fI statement\fP
130 e7c5e5ed 2009-08-18 mt4swm for(\fI var \fPin\fI array \fP)\fI statement\fP
131 e7c5e5ed 2009-08-18 mt4swm do\fI statement \fPwhile(\fI expression \fP)
134 e7c5e5ed 2009-08-18 mt4swm {\fR [\fP\fI statement ... \fP\fR] \fP}
135 e7c5e5ed 2009-08-18 mt4swm \fIexpression\fP #\fR commonly\fP\fI var = expression\fP
136 e7c5e5ed 2009-08-18 mt4swm print\fR [ \fP\fIexpression-list \fP\fR] \fP\fR[ \fP>\fI expression \fP\fR]\fP
137 e7c5e5ed 2009-08-18 mt4swm printf\fI format \fP\fR[ \fP,\fI expression-list \fP\fR] \fP\fR[ \fP>\fI expression \fP\fR]\fP
138 e7c5e5ed 2009-08-18 mt4swm return\fR [ \fP\fIexpression \fP\fR]\fP
139 e7c5e5ed 2009-08-18 mt4swm next #\fR skip remaining patterns on this input line\fP
140 e7c5e5ed 2009-08-18 mt4swm nextfile #\fR skip rest of this file, open next, start at top\fP
141 e7c5e5ed 2009-08-18 mt4swm delete\fI array\fP[\fI expression \fP] #\fR delete an array element\fP
142 e7c5e5ed 2009-08-18 mt4swm delete\fI array\fP #\fR delete all elements of array\fP
143 e7c5e5ed 2009-08-18 mt4swm exit\fR [ \fP\fIexpression \fP\fR]\fP #\fR exit immediately; status is \fP\fIexpression\fP
147 e7c5e5ed 2009-08-18 mt4swm Statements are terminated by
148 e7c5e5ed 2009-08-18 mt4swm semicolons, newlines or right braces.
150 e7c5e5ed 2009-08-18 mt4swm .I expression-list
151 e7c5e5ed 2009-08-18 mt4swm stands for
153 e7c5e5ed 2009-08-18 mt4swm String constants are quoted \&\fL"\ "\fR,
154 e7c5e5ed 2009-08-18 mt4swm with the usual C escapes recognized within.
155 e7c5e5ed 2009-08-18 mt4swm Expressions take on string or numeric values as appropriate,
156 e7c5e5ed 2009-08-18 mt4swm and are built using the operators
157 e7c5e5ed 2009-08-18 mt4swm .B + \- * / % ^
158 e7c5e5ed 2009-08-18 mt4swm (exponentiation), and concatenation (indicated by white space).
159 e7c5e5ed 2009-08-18 mt4swm The operators
161 e7c5e5ed 2009-08-18 mt4swm ! ++ \-\- += \-= *= /= %= ^= > >= < <= == != ?:
162 e7c5e5ed 2009-08-18 mt4swm are also available in expressions.
163 e7c5e5ed 2009-08-18 mt4swm Variables may be scalars, array elements
165 e7c5e5ed 2009-08-18 mt4swm .IB x [ i ] )
166 e7c5e5ed 2009-08-18 mt4swm or fields.
167 e7c5e5ed 2009-08-18 mt4swm Variables are initialized to the null string.
168 e7c5e5ed 2009-08-18 mt4swm Array subscripts may be any string,
169 e7c5e5ed 2009-08-18 mt4swm not necessarily numeric;
170 e7c5e5ed 2009-08-18 mt4swm this allows for a form of associative memory.
171 e7c5e5ed 2009-08-18 mt4swm Multiple subscripts such as
172 e7c5e5ed 2009-08-18 mt4swm .B [i,j,k]
173 e7c5e5ed 2009-08-18 mt4swm are permitted; the constituents are concatenated,
174 e7c5e5ed 2009-08-18 mt4swm separated by the value of
175 e7c5e5ed 2009-08-18 mt4swm .BR SUBSEP .
179 e7c5e5ed 2009-08-18 mt4swm statement prints its arguments on the standard output
180 e7c5e5ed 2009-08-18 mt4swm (or on a file if
181 e7c5e5ed 2009-08-18 mt4swm .BI > file
183 e7c5e5ed 2009-08-18 mt4swm .BI >> file
184 e7c5e5ed 2009-08-18 mt4swm is present or on a pipe if
185 e7c5e5ed 2009-08-18 mt4swm .BI | cmd
186 e7c5e5ed 2009-08-18 mt4swm is present), separated by the current output field separator,
187 e7c5e5ed 2009-08-18 mt4swm and terminated by the output record separator.
191 e7c5e5ed 2009-08-18 mt4swm may be literal names or parenthesized expressions;
192 e7c5e5ed 2009-08-18 mt4swm identical string values in different statements denote
193 e7c5e5ed 2009-08-18 mt4swm the same open file.
195 e7c5e5ed 2009-08-18 mt4swm .B printf
196 e7c5e5ed 2009-08-18 mt4swm statement formats its expression list according to the format
198 e7c5e5ed 2009-08-18 mt4swm .IR fprintf (3)) .
199 e7c5e5ed 2009-08-18 mt4swm The built-in function
200 e7c5e5ed 2009-08-18 mt4swm .BI close( expr )
201 e7c5e5ed 2009-08-18 mt4swm closes the file or pipe
202 e7c5e5ed 2009-08-18 mt4swm .IR expr .
203 e7c5e5ed 2009-08-18 mt4swm The built-in function
204 e7c5e5ed 2009-08-18 mt4swm .BI fflush( expr )
205 e7c5e5ed 2009-08-18 mt4swm flushes any buffered output for the file or pipe
206 e7c5e5ed 2009-08-18 mt4swm .IR expr .
209 e7c5e5ed 2009-08-18 mt4swm is omitted or is a null string, all open files are flushed.
211 e7c5e5ed 2009-08-18 mt4swm The mathematical functions
212 e7c5e5ed 2009-08-18 mt4swm .BR exp ,
213 e7c5e5ed 2009-08-18 mt4swm .BR log ,
214 e7c5e5ed 2009-08-18 mt4swm .BR sqrt ,
215 e7c5e5ed 2009-08-18 mt4swm .BR sin ,
216 e7c5e5ed 2009-08-18 mt4swm .BR cos ,
218 e7c5e5ed 2009-08-18 mt4swm .BR atan2
219 e7c5e5ed 2009-08-18 mt4swm are built in.
220 e7c5e5ed 2009-08-18 mt4swm Other built-in functions:
221 e7c5e5ed 2009-08-18 mt4swm .TF length
223 e7c5e5ed 2009-08-18 mt4swm .B length
224 e7c5e5ed 2009-08-18 mt4swm If its argument is a string, the string's length is returned.
225 e7c5e5ed 2009-08-18 mt4swm If its argument is an array, the number of subscripts in the array is returned.
226 e7c5e5ed 2009-08-18 mt4swm If no argument, the length of
228 e7c5e5ed 2009-08-18 mt4swm is returned.
231 e7c5e5ed 2009-08-18 mt4swm random number on (0,1)
234 e7c5e5ed 2009-08-18 mt4swm sets seed for
236 e7c5e5ed 2009-08-18 mt4swm and returns the previous seed.
239 e7c5e5ed 2009-08-18 mt4swm truncates to an integer value
242 e7c5e5ed 2009-08-18 mt4swm converts its numerical argument, a character number, to a
246 e7c5e5ed 2009-08-18 mt4swm .BI substr( s , " m" , " n\fL)
248 e7c5e5ed 2009-08-18 mt4swm .IR n -character
249 e7c5e5ed 2009-08-18 mt4swm substring of
251 e7c5e5ed 2009-08-18 mt4swm that begins at position
253 e7c5e5ed 2009-08-18 mt4swm counted from 1.
255 e7c5e5ed 2009-08-18 mt4swm .BI index( s , " t" )
256 e7c5e5ed 2009-08-18 mt4swm the position in
258 e7c5e5ed 2009-08-18 mt4swm where the string
260 e7c5e5ed 2009-08-18 mt4swm occurs, or 0 if it does not.
262 e7c5e5ed 2009-08-18 mt4swm .BI match( s , " r" )
263 e7c5e5ed 2009-08-18 mt4swm the position in
265 e7c5e5ed 2009-08-18 mt4swm where the regular expression
267 e7c5e5ed 2009-08-18 mt4swm occurs, or 0 if it does not.
268 e7c5e5ed 2009-08-18 mt4swm The variables
269 e7c5e5ed 2009-08-18 mt4swm .B RSTART
271 e7c5e5ed 2009-08-18 mt4swm .B RLENGTH
272 e7c5e5ed 2009-08-18 mt4swm are set to the position and length of the matched string.
274 e7c5e5ed 2009-08-18 mt4swm .BI split( s , " a" , " fs\fL)
275 e7c5e5ed 2009-08-18 mt4swm splits the string
277 e7c5e5ed 2009-08-18 mt4swm into array elements
278 e7c5e5ed 2009-08-18 mt4swm .IB a [1]\f1,
279 e7c5e5ed 2009-08-18 mt4swm .IB a [2]\f1,
281 e7c5e5ed 2009-08-18 mt4swm .IB a [ n ]\f1,
282 e7c5e5ed 2009-08-18 mt4swm and returns
284 e7c5e5ed 2009-08-18 mt4swm The separation is done with the regular expression
286 e7c5e5ed 2009-08-18 mt4swm or with the field separator
290 e7c5e5ed 2009-08-18 mt4swm is not given.
291 e7c5e5ed 2009-08-18 mt4swm An empty string as field separator splits the string
292 e7c5e5ed 2009-08-18 mt4swm into one array element per character.
294 e7c5e5ed 2009-08-18 mt4swm .BI sub( r , " t" , " s\fL)
295 e7c5e5ed 2009-08-18 mt4swm substitutes
297 e7c5e5ed 2009-08-18 mt4swm for the first occurrence of the regular expression
299 e7c5e5ed 2009-08-18 mt4swm in the string
303 e7c5e5ed 2009-08-18 mt4swm is not given,
310 e7c5e5ed 2009-08-18 mt4swm except that all occurrences of the regular expression
311 e7c5e5ed 2009-08-18 mt4swm are replaced;
315 e7c5e5ed 2009-08-18 mt4swm return the number of replacements.
317 e7c5e5ed 2009-08-18 mt4swm .BI sprintf( fmt , " expr" , " ...\fL)
318 e7c5e5ed 2009-08-18 mt4swm the string resulting from formatting
319 e7c5e5ed 2009-08-18 mt4swm .I expr ...
320 e7c5e5ed 2009-08-18 mt4swm according to the
321 e7c5e5ed 2009-08-18 mt4swm .I printf
325 e7c5e5ed 2009-08-18 mt4swm .BI system( cmd )
328 e7c5e5ed 2009-08-18 mt4swm and returns its exit status
330 e7c5e5ed 2009-08-18 mt4swm .BI tolower( str )
331 e7c5e5ed 2009-08-18 mt4swm returns a copy of
333 e7c5e5ed 2009-08-18 mt4swm with all upper-case characters translated to their
334 e7c5e5ed 2009-08-18 mt4swm corresponding lower-case equivalents.
336 e7c5e5ed 2009-08-18 mt4swm .BI toupper( str )
337 e7c5e5ed 2009-08-18 mt4swm returns a copy of
339 e7c5e5ed 2009-08-18 mt4swm with all lower-case characters translated to their
340 e7c5e5ed 2009-08-18 mt4swm corresponding upper-case equivalents.
343 e7c5e5ed 2009-08-18 mt4swm The ``function''
344 e7c5e5ed 2009-08-18 mt4swm .B getline
347 e7c5e5ed 2009-08-18 mt4swm to the next input record from the current input file;
348 e7c5e5ed 2009-08-18 mt4swm .B getline
349 e7c5e5ed 2009-08-18 mt4swm .BI < file
352 e7c5e5ed 2009-08-18 mt4swm to the next record from
353 e7c5e5ed 2009-08-18 mt4swm .IR file .
354 e7c5e5ed 2009-08-18 mt4swm .B getline
356 e7c5e5ed 2009-08-18 mt4swm sets variable
360 e7c5e5ed 2009-08-18 mt4swm .IB cmd " | getline
361 e7c5e5ed 2009-08-18 mt4swm pipes the output of
364 e7c5e5ed 2009-08-18 mt4swm .BR getline ;
365 e7c5e5ed 2009-08-18 mt4swm each call of
366 e7c5e5ed 2009-08-18 mt4swm .B getline
367 e7c5e5ed 2009-08-18 mt4swm returns the next line of output from
368 e7c5e5ed 2009-08-18 mt4swm .IR cmd .
369 e7c5e5ed 2009-08-18 mt4swm In all cases,
370 e7c5e5ed 2009-08-18 mt4swm .B getline
371 e7c5e5ed 2009-08-18 mt4swm returns 1 for a successful input,
372 e7c5e5ed 2009-08-18 mt4swm 0 for end of file, and \-1 for an error.
374 e7c5e5ed 2009-08-18 mt4swm Patterns are arbitrary Boolean combinations
376 e7c5e5ed 2009-08-18 mt4swm .BR "! || &&" )
377 e7c5e5ed 2009-08-18 mt4swm of regular expressions and
378 e7c5e5ed 2009-08-18 mt4swm relational expressions.
379 e7c5e5ed 2009-08-18 mt4swm Regular expressions are as in
380 e7c5e5ed 2009-08-18 mt4swm .IR regexp (7).
381 e7c5e5ed 2009-08-18 mt4swm Isolated regular expressions
382 e7c5e5ed 2009-08-18 mt4swm in a pattern apply to the entire line.
383 e7c5e5ed 2009-08-18 mt4swm Regular expressions may also occur in
384 e7c5e5ed 2009-08-18 mt4swm relational expressions, using the operators
388 e7c5e5ed 2009-08-18 mt4swm .BI / re /
389 e7c5e5ed 2009-08-18 mt4swm is a constant regular expression;
390 e7c5e5ed 2009-08-18 mt4swm any string (constant or variable) may be used
391 e7c5e5ed 2009-08-18 mt4swm as a regular expression, except in the position of an isolated regular expression
392 e7c5e5ed 2009-08-18 mt4swm in a pattern.
394 e7c5e5ed 2009-08-18 mt4swm A pattern may consist of two patterns separated by a comma;
395 e7c5e5ed 2009-08-18 mt4swm in this case, the action is performed for all lines
396 e7c5e5ed 2009-08-18 mt4swm from an occurrence of the first pattern
397 e7c5e5ed 2009-08-18 mt4swm though an occurrence of the second.
399 e7c5e5ed 2009-08-18 mt4swm A relational expression is one of the following:
401 e7c5e5ed 2009-08-18 mt4swm .I expression matchop regular-expression
403 e7c5e5ed 2009-08-18 mt4swm .I expression relop expression
405 e7c5e5ed 2009-08-18 mt4swm .IB expression " in " array-name
407 e7c5e5ed 2009-08-18 mt4swm .BI ( expr , expr,... ") in " array-name
411 e7c5e5ed 2009-08-18 mt4swm is any of the six relational operators in C,
413 e7c5e5ed 2009-08-18 mt4swm .I matchop
414 e7c5e5ed 2009-08-18 mt4swm is either
416 e7c5e5ed 2009-08-18 mt4swm (matches)
419 e7c5e5ed 2009-08-18 mt4swm (does not match).
420 e7c5e5ed 2009-08-18 mt4swm A conditional is an arithmetic expression,
421 e7c5e5ed 2009-08-18 mt4swm a relational expression,
422 e7c5e5ed 2009-08-18 mt4swm or a Boolean combination
423 e7c5e5ed 2009-08-18 mt4swm of these.
425 e7c5e5ed 2009-08-18 mt4swm The special patterns
429 e7c5e5ed 2009-08-18 mt4swm may be used to capture control before the first input line is read
430 e7c5e5ed 2009-08-18 mt4swm and after the last.
434 e7c5e5ed 2009-08-18 mt4swm do not combine with other patterns.
436 e7c5e5ed 2009-08-18 mt4swm Variable names with special meanings:
437 e7c5e5ed 2009-08-18 mt4swm .TF FILENAME
439 e7c5e5ed 2009-08-18 mt4swm .B CONVFMT
440 e7c5e5ed 2009-08-18 mt4swm conversion format used when converting numbers
442 e7c5e5ed 2009-08-18 mt4swm .BR "%.6g" )
445 e7c5e5ed 2009-08-18 mt4swm regular expression used to separate fields; also settable
446 e7c5e5ed 2009-08-18 mt4swm by option
447 e7c5e5ed 2009-08-18 mt4swm .BI \-F fs\f1.
450 e7c5e5ed 2009-08-18 mt4swm number of fields in the current record
453 e7c5e5ed 2009-08-18 mt4swm ordinal number of the current record
456 e7c5e5ed 2009-08-18 mt4swm ordinal number of the current record in the current file
458 e7c5e5ed 2009-08-18 mt4swm .B FILENAME
459 e7c5e5ed 2009-08-18 mt4swm the name of the current input file
462 e7c5e5ed 2009-08-18 mt4swm input record separator (default newline)
465 e7c5e5ed 2009-08-18 mt4swm output field separator (default blank)
468 e7c5e5ed 2009-08-18 mt4swm output record separator (default newline)
471 e7c5e5ed 2009-08-18 mt4swm output format for numbers (default
472 e7c5e5ed 2009-08-18 mt4swm .BR "%.6g" )
474 e7c5e5ed 2009-08-18 mt4swm .B SUBSEP
475 e7c5e5ed 2009-08-18 mt4swm separates multiple subscripts (default 034)
478 e7c5e5ed 2009-08-18 mt4swm argument count, assignable
481 e7c5e5ed 2009-08-18 mt4swm argument array, assignable;
482 e7c5e5ed 2009-08-18 mt4swm non-null members are taken as file names
484 e7c5e5ed 2009-08-18 mt4swm .B ENVIRON
485 e7c5e5ed 2009-08-18 mt4swm array of environment variables; subscripts are names.
488 e7c5e5ed 2009-08-18 mt4swm Functions may be defined (at the position of a pattern-action statement) thus:
491 e7c5e5ed 2009-08-18 mt4swm function foo(a, b, c) { ...; return x }
493 e7c5e5ed 2009-08-18 mt4swm Parameters are passed by value if scalar and by reference if array name;
494 e7c5e5ed 2009-08-18 mt4swm functions may be called recursively.
495 e7c5e5ed 2009-08-18 mt4swm Parameters are local to the function; all other variables are global.
496 e7c5e5ed 2009-08-18 mt4swm Thus local variables may be created by providing excess parameters in
497 e7c5e5ed 2009-08-18 mt4swm the function definition.
498 e7c5e5ed 2009-08-18 mt4swm .SH EXAMPLES
501 e7c5e5ed 2009-08-18 mt4swm length($0) > 72
502 e7c5e5ed 2009-08-18 mt4swm Print lines longer than 72 characters.
505 e7c5e5ed 2009-08-18 mt4swm { print $2, $1 }
506 e7c5e5ed 2009-08-18 mt4swm Print first two fields in opposite order.
509 e7c5e5ed 2009-08-18 mt4swm BEGIN { FS = ",[ \et]*|[ \et]+" }
510 e7c5e5ed 2009-08-18 mt4swm { print $2, $1 }
514 e7c5e5ed 2009-08-18 mt4swm Same, with input fields separated by comma and/or blanks and tabs.
517 e7c5e5ed 2009-08-18 mt4swm { s += $1 }
518 e7c5e5ed 2009-08-18 mt4swm END { print "sum is", s, " average is", s/NR }
522 e7c5e5ed 2009-08-18 mt4swm Add up first column, print sum and average.
525 e7c5e5ed 2009-08-18 mt4swm /start/, /stop/
526 e7c5e5ed 2009-08-18 mt4swm Print all lines between start/stop pairs.
529 e7c5e5ed 2009-08-18 mt4swm BEGIN { # Simulate echo(1)
530 e7c5e5ed 2009-08-18 mt4swm for (i = 1; i < ARGC; i++) printf "%s ", ARGV[i]
531 e7c5e5ed 2009-08-18 mt4swm printf "\en"
534 e7c5e5ed 2009-08-18 mt4swm .SH SOURCE
535 e7c5e5ed 2009-08-18 mt4swm .B \*9/src/cmd/awk
536 e7c5e5ed 2009-08-18 mt4swm .SH SEE ALSO
537 e7c5e5ed 2009-08-18 mt4swm .IR sed (1),
538 e7c5e5ed 2009-08-18 mt4swm .IR regexp (7),
540 e7c5e5ed 2009-08-18 mt4swm A. V. Aho, B. W. Kernighan, P. J. Weinberger,
542 e7c5e5ed 2009-08-18 mt4swm The AWK Programming Language,
543 e7c5e5ed 2009-08-18 mt4swm Addison-Wesley, 1988. ISBN 0-201-07981-X
545 e7c5e5ed 2009-08-18 mt4swm There are no explicit conversions between numbers and strings.
546 e7c5e5ed 2009-08-18 mt4swm To force an expression to be treated as a number add 0 to it;
547 e7c5e5ed 2009-08-18 mt4swm to force it to be treated as a string concatenate
548 e7c5e5ed 2009-08-18 mt4swm \&\fL""\fP to it.
550 e7c5e5ed 2009-08-18 mt4swm The scope rules for variables in functions are a botch;
551 e7c5e5ed 2009-08-18 mt4swm the syntax is worse.
553 e7c5e5ed 2009-08-18 mt4swm UTF is not always dealt with correctly,
556 e7c5e5ed 2009-08-18 mt4swm does make an attempt to do so.
559 e7c5e5ed 2009-08-18 mt4swm function with an empty string as final argument now copes
560 e7c5e5ed 2009-08-18 mt4swm with UTF in the string being split.