AT&T UNIX™PC Unix System V Users Manual - tenox
AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox
AWK (l) AWK (l) NAME awk - pattern scanning and processing language SYNOPSIS awk [ -Fe ] [ prog ] [ parameters ] [ files ] DESCRIPTION A wk scans each input file for lines that match any of a set of patterns specified in prog . With each pattern in prog there can be an associated action that will be performed when a line of a file matches the pattern. The set of patterns may appear literally as prog, or in a file specified as -f file . The prog string should be enclosed in single quotes ( 1) to protect it from the shell. Parameters, in the form x= ... y= ... etc., may be passed to awk. Files are read in order; if there are no files, the standard input is read. The file name - means the standard input. Each line is matched against the pattern portion of every pattern-action statement; the associated action is performed for each matched pattern. An input line is made up of fields separated by white space. (This default can be changed by using FS, see below). The fields are denoted $1, $2, ... ; $0 refers to the entire line. A pattern-action statement has the form: pattern { action } A missing action means print the line; a missing pattern always matches. An action is a sequence of statements. A statement can be one of the following: if ( conditional ) statement [ else statement ] while ( conditional ) statement for ( expression conditional ; expression ) statement break continue { [ statement ] . .. } variable = expression print [ expression-list ] [ >expression ] printf format [ , expression-list ] [ >expression ] next # skip remaining patterns on this input line exit # skip the rest of the input Statements are terminated by semicolons, new-lines, or right braces. An empty expression-list stands for the whole line. Expressions take on string or numeric values as appropriate, and are built using the operators +, -, *, /, % , and concatenation (indicated by a blank). The C operators ++, --, +=, -=, *=, /=, and %= are also available in expressions. Variables may be scalars, array elements (denoted x[i]) or fields. Variables are initialized to the null string. Array subscripts may be any string, not necessarily numeric; this allows for a form of associative memory. String constants are quoted ( "). The print statement prints its arguments on the standard output (or on a file if > expr is present), separated by the current output - 1 -
- Page 139 and 140: ldohseek: seek to the optional file
- Page 141 and 142: cpio: format of cpio archive. dir:
- Page 143 and 144: getpw: get name rrom UID. . • set
- Page 145 and 146: abort: generate an semaphore set or
- Page 147 and 148: passwd: change login password. sett
- Page 149 and 150: operations. msgctl: message control
- Page 151 and 152: split: split a file into channel. t
- Page 153 and 154: generate e program cross reference.
- Page 155 and 156: stream. setbuf: assign buffering to
- Page 157 and 158: � Permuted Index /strcmp, strncmp
- Page 159 and 160: tsort: topologica.l sort. • . .
- Page 161 and 162: display editor based on/ vi, view:
- Page 163: INTRO ( 1) INTRO ( l ) NAME intro -
- Page 166 and 167: 300 ( 1 ) 300 ( 1 ) for C programs,
- Page 168 and 169: \�
- Page 170 and 171: I I I I I I I I I I I I I I I I I I
- Page 172 and 173: ADB ( 1 ) ADB (l) sr, and usp. symb
- Page 174 and 175: ADB ( 1} ADB (l} " ••• " 0 Pr
- Page 176 and 177: ADB ( 1) ADDRESSES b d e m 8 t The
- Page 178 and 179: ADMIN ( 1) -t[name] -fflag b ADMIN(
- Page 180 and 181: ADMIN(l) ADMIN(l) make deltas (chan
- Page 182 and 183: ( � � . · � .
- Page 184 and 185: AR(l) AR (I) X Extract the named fi
- Page 186 and 187: AS (l) (AT&T UNIX PC Only ) AS (I)
- Page 188 and 189: ·� · ·. rl · (1
- Page 192 and 193: AWK (l) AWK (l) field separator, an
- Page 195 and 196: BANNER (!) BANNER (!) NAME banner -
- Page 197 and 198: BASE NAME ( 1 ) BASE NAME ( 1 ) NAM
- Page 199 and 200: BC ( l ) BC ( l ) NAME be - arbitra
- Page 201: �- BC (l) BC (1) BUGS No &&, I I
- Page 204 and 205: (� ·. , '(Y � . ' :J
- Page 206 and 207: BFS(l) BFS (l) : label This positio
- Page 208 and 209: BFS (l) BFS (l) SEE ALSO csplit(l),
- Page 211 and 212: CAT ( l ) CAT ( l ) NAME cat - conc
- Page 213: CB ( l ) CB ( l ) NAME cb - C progr
- Page 216 and 217: CC (l) FILES cc ( 1 ) -Wa,-m passes
- Page 219: CD (I) CD (I) NAME cd - change work
- Page 222 and 223: CDC ( 1) CDC (1) MRs in a list are
- Page 225 and 226: CFLOW {l) CFLOW (l) NAME cfiow - ge
- Page 227 and 228: CFONT ( l ) ( AT&T UNIX PC only ) C
- Page 229: CHMOD (l) CHMOD (l) NAME chmod - ch
- Page 233 and 234: CLEAR ( l ) CLEAR ( l ) NAME clear
- Page 235 and 236: CMP ( l ) CMP ( l ) NAME cmp - comp
- Page 237 and 238: COL { 1 ) COL ( 1) NAME col - filte
- Page 239 and 240: COMB{l) COMB(l) NAME comb - combine
AWK (l) AWK (l)<br />
NAME<br />
awk - pattern scanning and processing language<br />
SYNOPSIS<br />
awk [ -Fe ] [ prog ] [ parameters ] [ files ]<br />
DESCRIPTION<br />
A wk scans each input file for lines that match any of a set of patterns<br />
specified in prog . With each pattern in prog there can be an<br />
associated action that will be performed when a line of a file<br />
matches the pattern. The set of patterns may appear literally as<br />
prog, or in a file specified as -f file . The prog string should be<br />
enclosed in single quotes ( 1) to protect it from the shell.<br />
Parameters, in the form x= ... y= ... etc., may be passed to awk.<br />
Files are read in order; if there are no files, the standard input is<br />
read. The file name - means the standard input. Each line is<br />
matched against the pattern portion of every pattern-action statement;<br />
the associated action is performed for each matched pattern.<br />
An input line is made up of fields separated by white space. (This<br />
default can be changed by using FS, see below). The fields are<br />
denoted $1, $2, ... ; $0 refers to the entire line.<br />
A pattern-action statement has the form:<br />
pattern { action }<br />
A missing action means print the line; a missing pattern always<br />
matches. An action is a sequence of statements. A statement can<br />
be one of the following:<br />
if ( conditional ) statement [ else statement ]<br />
while ( conditional ) statement<br />
for ( expression conditional ; expression ) statement<br />
break<br />
continue<br />
{ [ statement ] . .. }<br />
variable = expression<br />
print [ expression-list ] [ >expression ]<br />
printf format [ , expression-list ] [ >expression ]<br />
next # skip remaining patterns on this input line<br />
exit # skip the rest of the input<br />
Statements are terminated by semicolons, new-lines, or right<br />
braces. An empty expression-list stands for the whole line.<br />
Expressions take on string or numeric values as appropriate, and<br />
are built using the operators +, -, *, /, % , and concatenation<br />
(indicated by a blank). The C operators ++, --, +=, -=,<br />
*=, /=, and %= are also available in expressions. Variables<br />
may be scalars, array elements (denoted x[i]) or fields. Variables<br />
are initialized to the null string. Array subscripts may be any<br />
string, not necessarily numeric; this allows for a form of associative<br />
memory. String constants are quoted ( ").<br />
The print statement prints its arguments on the standard output<br />
(or on a file if > expr is present), separated by the current output<br />
- 1 -