awkdata transformation, report generation language |
Command |
awk
[-F
ere]
[-f
prog]
[-v
var=value ...] [program]
[var=value ...] [file ...]
awk
is a file-processing language which is well suited to
data manipulation and retrieval of information from text files. This reference
page provides a full technical description of awk
. If you
are unfamiliar with the language, you may find it helpful to read the online
AWK Tutorial before reading the following material.
An awk
program consists of any number of user-defined
functions and rules in the form:
There are two ways to specify thepattern {action}
awk
program:
Directly on the command line. In this case, the program is a
single command line argument, usually enclosed in apostrophes
('
) to prevent the shell from attempting to expand it.
By using the -f
prog option.
-f
prog arguments.
When you specify files on the command line, those files provide the input
data for awk
to manipulate. If you specify no such files or
you specify -
as a file, awk
reads data
from the standard input.
You can initialize variables on the command line using
You can intersperse such initializations with the names of input files on the command line.var=value
awk
processes initializations and input files
in the order they appear on the command line. For example, the command
setsawk -f progfile a=1 f1 f2 a=2 f3
a
to 1
before reading input from f1
and sets a
to 2
before reading input from
f3
.
Variable initializations that appear before the first file on the command
line are performed immediately after the BEGIN
action.
Initializations appearing after the last file are performed immediately
before the END
action. For more information on BEGIN
and END
, see Patterns.
The -v
option lets you assign a value to a variable before
the awk
program begins running (that is, before the
BEGIN
action). For example, in
awk -v v1=10 -f prog datafile
awk
assigns the variable v1
its value before
the BEGIN
action of the program (but after default assignments made
to built-in variables like FS
and OFMT
; these built-in
variables have special meaning to awk
, as described in later
sections).
awk
divides input into records. By default,
newline characters separate records; however, you may specify a different record
separator if you want.
One at a time, and in order, awk
compares each input record
with the pattern of every rule in the program. When a pattern matches,
awk
performs the action part of the rule on that input
record. Patterns and actions often refer to separate fields within
a record. By default, white space (usually blanks, newlines, or horizontal tab
characters) separates fields; however, you can specify a different field
separator string using the -F
ere option (see
Input).
You can omit the pattern or action part of an
awk
rule (but not both). If you omit pattern,
awk
performs the action on every input record (that
is, every record matches). If you omit action, awk
writes every record matching the pattern to the standard output.
awk
considers everything after a #
in a program
line to be a comment. For example:
To continue program lines on the next line, add a backslash (# This is a comment
\
) to
the end of the line. Statement lines ending with a comma (,
),
double or-bars (||
), or double ampersands (&&
)
continue automatically on the next line.
-F
erespecifies an extended regular expression to use as the field separator.
-f
progruns the awk
program contained in the file
prog. When more than one -f
option appears on
the command line, the resulting program is a concatenation of all programs
you specify.
-v
var=valueassigns value to var before running the program. You can specify this option a number of times.
awk
:
identifiers, fields and array elements.
An identifier is a sequence of letters, digits and underscores
beginning with a letter or an underscore.
For a description of fields, see the Input
subsection.
Arrays are associative collections of values called the elements
of the array. Constructs of the form,
where subscript has the form expr or expr,expr,.... refer to array elements. Each such expr can have any string value. For multiple expr subscripts,identifier[subscript]
awk
concatenates the string values
of all exprs with a separate character SUBSEP
between each.
The initial value of SUBSEP
is set to \034
(ASCII
field separator).
Fields and identifiers are sometimes referred to as
scalar variables to distinguish them from arrays.
You do not declare awk
variables and you do not need to
initialize them. The value of an uninitialized variable is the empty string in a
string context and the number 0 in a numeric context.
Expressions consist of constants, variables, functions, regular expressions and
subscript in array conditions (described later) combined with
operators. Each variable and expression has a string value and a corresponding
numeric value; awk
uses the value appropriate to the context.
When converting a numeric value to its corresponding string value,
awk
performs the equivalent of a call to the
sprintf
function (see
Built-In String Functions). The
one and only expr argument is the numeric value and the fmt
argument is either %d
(if the numeric value is an integer) or the
value of the variable CONVFMT
(if the numeric value is not an
integer). The default value of CONVFMT
is %.6g
. If you
use a string in a numeric context, and awk
cannot interpret
the contents of the string as a number, it treats the value of the string as
zero.
Numeric constants are sequences of decimal digits.
String constants are quoted, as in "a literal string"
. Literal
strings can contain the escape sequences shown in Table 1, Escape Sequences
in awk
Literal Strings.
awk
supports extended regular expressions (see
regexp
). When
awk
reads a program, it compiles characters enclosed in
slash characters (/
) as regular expressions. In addition, when
literal strings and variables appear on the right side of a ~
or
!~
operator, or as certain arguments to built-in matching and
substitution functions, awk
interprets them as dynamic
regular expressions.
Escape | Character |
\a | audible bell |
\b | backspace |
\f | formfeed |
\n | newline |
\r | carriage return |
\t | horizontal tab |
\v | vertical tab |
\ ooo | octal value ooo |
\x dd | hexadecimal value dd |
\/ | slash |
\" | quote |
Table 1: Escape Sequences in awk
Literal Strings
When you use literal strings as regular expressions, you need extra backslashes to escape regular expression metacharacters, since the backslash is also the literal string escape character. For example the regular expression,
/e\.g\./
when written as a string is:
"e\\.g\\."
awk
defines the subscript in array condition
as:
where index looks like expr or (expr,...,expr). This condition evaluates toindex in array
1
if the string value of index is a
subscript of array, and to 0
otherwise. This is a way to
determine if an array element exists. When the element does not exist, this
condition does not create it.
SYMTAB
.
is equivalent to the variable named by the evaluation of expr. For example,SYMTAB[expr]
is a synonym for the variableSYMTAB["var"]
var
.
awk
program can determine its initial environment by
examining the ENVIRON
array. If the environment consists of entries
of the form:
thenname=value
has string valueENVIRON[name]
For example, the following program is equivalent to the default output of"value"
env
:
BEGIN { for (i in ENVIRON) printf("%s=%s\n", i, ENVIRON[i]) exit }
awk
follows the usual precedence order of arithmetic
operations, unless overridden with parentheses; a table giving the order of
operations appears later in this section.
The unary operators are +
, -
, ++
and
--
, where you can use the ++
and --
operators as either postfix or prefix operators, as in C. The binary arithmetic
operators are +
, -
, *
, /
,
%
and ^
.
The conditional operator
evaluates to expr1 if the value of expr is non-zero, and to expr2 otherwise. If two expressions are not separated by an operator,expr ? expr1 : expr2
awk
concatenates their string values.
The operator ~
yields 1 (true) if the regular expression on the
right side matches the string on the left side. The operator !~
yields 1 when the right side has no match on the left. To illustrate:
selects any line where the second field contains at least one digit.$2 ~ /[0-9]/
awk
interprets any string or variable on the right side of
~
or !~
as a dynamic regular expression.
The relational operators are <
, <=
,
>
, >=
, ==
and !=
.
When both operands in a comparison are numeric, awk
compares
their values numerically; otherwise it compares them as strings. An operand is
numeric if it is an integer or floating point number, if it is a field or
ARGV
element that looks like a number, or if it is a variable
created by a command line assignment that looks like a number.
The Boolean operators are ||
(or), &&
(and)
and !
(not). Short Circuit Evaluation is used when evaluating
expressions. With an &&
expression, if the first operator
is false, the entire expression is false and it is not necessary to evaluate the
second operator. With an ||
expression, a similar situation exists
if the first operator is true.
You can assign values to a variable with
If op is a binary arithmetic operator,var = expr
is equivalent tovar op= expr
except that var is evaluated only once. See Table 2, awk Order of Operations for the precedence rules of the operators.var = var op expr
awk
sets the built-in variable ARGC
to the
number of command line arguments. The built-in array ARGV
has
elements subscripted with digits from zero to ARGC
-1, giving
command line arguments in the order they appeared on the command line.
The ARGC
count and the ARGV
vector do not include
command line options (beginning with -
) or the program file
(following -f
). They do include the name of the command
itself, initialization statements of the form
and the names of input data files.var=value
awk
actually creates ARGC
and ARGV
before doing anything else. It then walks through ARGV
processing
the arguments. If an element of ARGV
is an empty string,
awk
skips it. If it contains an equals sign (=
),
awk
interprets it as a variable assignment. If it is a minus
sign (-
), awk
immediately reads input from the
standard input until it encounters the end-of-file; otherwise,
awk
treats the argument as a file name and reads input from
that file until it reaches end-of-file.
awk
runs the program by walking through
ARGV
in this way; thus if the program changes
ARGV
, awk
can read different files and
make different assignments.
awk
divides input into records. A record separator
character separates each record from the next. The value of the built-in
variable RS
gives the current record separator character; by
default, it begins as the newline (\n
). If you assign a different
character to RS
, awk
uses that as the record
separator character from that point on.
Order of Operations | |
---|---|
(A) | grouping |
$ i V[a] | field, array element |
V++ V-- | increment, decrement |
++V --V | |
A^B | exponentiation |
+A -A !A | unary plus, unary minus, logical NOT |
A*B A/B A%B | multiplication, division, remainder |
A+B A-B | addition, subtraction |
A B | string concatenation |
A<B A>B A<=B | comparisons |
A>=B A!=B A==B | |
A~B A!~B | regular expression matching |
A in V | array membership |
A && B | logical AND |
A || B | logical OR |
A ? B : C | conditional expression |
V=B V+=B V-=B | assignment |
V*=B V/=B V%=B | |
V^=B | |
A , B and C are any expression. | |
i is any expression yielding an integer. | |
V is any variable. |
Table 2: awk
Order of Operations
awk
divides records into fields. A field separator
string, given by the value of the built-in variable FS
,
separates each field from the next. You can set a specific separator string by
assigning a value to FS
, or by specifying the -F
ere option on the command line. You can assign a regular expression to
FS
. For example,
says that commas, colons or dollar signs can separate fields. As a special case, assigningFS = "[,:$]"
FS
a string containing only a blank character sets the
field separator to white space. In this case, awk
considers
any sequence of contiguous space and/or tab characters a single field separator.
This is the default for FS
; however, if you assign FS
a string containing any other character, that character designates the start of
a new field. For example, if you set FS
="\t"
(the tab
character),
contains five fields, two of which contain only blanks. With the default setting, this record contains only three fields, sincetexta \t textb \t \t \t textc
awk
considers
the sequence of multiple blanks and tabs a single separator.
The following list of built-in variables provides various pieces of information
about input.
Field specifiers have the formNF number of fields in the current record NR number of records read so far FILENAME name of file containing current record FNR number of records read from current file
$
n where
n runs from 1
through NF
. Such a field
specifier refers to the nth field of the current input record.
$0
(zero) refers to the entire current input record.
The getline
function can read a value for a variable or
$0
from the current input, from a file, or from a pipe.
The result of getline
is an integer indicating whether
the read operation was successful.
A value of 1
indicates success; 0
indicates
end-of-file encountered; and -1
indicates that an error occurred.
Possible forms for getline
are:
getline
reads next input record into $0
and splits the record into
fields. NF
, NR
and FNR
are set
appropriately.
getline
varreads next input record into the variable var.
awk
does not split the record into fields (which means
that the current $
n values do not change), but sets
NR
and FNR
appropriately.
getline <
exprinterprets the string value of expr to be a file name.
awk
reads the next record from that file into
$0
, splits it into fields and sets NF
appropriately. If the file is not open, awk
opens it.
The file remains open until you close it with a close()
function.
getline
var <
exprinterprets the string value of expr to be a file name and reads the next record from that file into the variable var, but does not split it into fields.
| getline
interprets the string value of expr as a command line to be run.
awk
pipes output from this command into
getline
and reads it into $0
in a manner similar
to getline <
expr. See the
System Function section for
additional details.
| getline
varruns the string value of expr as a command and pipes the output
of the command into getline
. The result is similar to
getline
var <
expr.
function. The expr must be one that came beforeclose(expr)
|
or after
<
in getline
, or after >
or
>>
in print
or printf
.
For a description of print
and printf
,
see the Output section. If the function
successfully closes the pipe, it returns zero. By closing files and pipes that
you no longer need, you can use any number of files and pipes in the course of
running an awk
program.
atan2(
expr1,
expr2)
returns the arctangent of expr1/
expr2 in the
range of -pi through pi.
exp(
expr)
, log(
expr)
,
sqrt(
expr)
returns the exponential, natural logarithm, and square root of the
numeric value of expr. If you omit
(
expr)
, these functions use
$0
instead.
int(
expr)
returns the integer part of the numeric value of expr. If you
omit (
expr)
, the function returns the
integer part of $0
.
rand()
returns a random floating-point number in the range 0 through 1.
sin(
expr)
, cos(
expr)
returns the sine and cosine of the numeric value of expr (interpreted as an angle in radians).
srand(
expr)
sets the seed of the rand()
function to the integer value
of expr. If you omit (
expr)
,
awk
uses the time of day as a default seed.
= gsub(
regexp,
repl,
string)
works the same way as sub()
, except that
gsub()
replaces all matching substrings (global substitution).
The return value is the number of substitutions performed.
= index(
string,
str)
returns the position of the first occurrence of str in
string. If index()
does not find str in
string, it returns zero.
= length(
expr)
returns the number of characters in the string value of expr. If
you omit (
expr)
, the function uses
$0
instead. The parentheses around expr are
optional.
pos = match(string, regexp)
searches string for the first substring matching the regular
expression regexp and returns an integer giving the position of
this substring counting characters; the count starts at one. If it finds
no such substring, match()
returns zero. This function also
sets the built-in variable RSTART
to pos and the
built-in variable RLENGTH
to the length of the matched string.
If it does not find a match, match()
sets RSTART
to zero and RLENGTH
to -1
. You can enclose
regexp in slashes or specify it as a string.
= ord(
expr)
returns the integer value of first character in the string value of
expr. This is useful in conjunction with %c
in
sprintf()
.
= split(
string,
array,
regexp)
splits string into fields. regexp is a regular expression
giving the field separator string for the purposes of this operation. This
function assigns the separate fields, in order, to the elements of
array; subscripts for array begin at 1.
awk
discards all other elements of array.
split()
returns the number of fields into which it divided
string (which is also the maximum subscript for array).
regexp divides the record in the same way that the FS
field separator string does. If you omit regexp in the call to
split()
, it uses the current value of FS
.
= sprintf(
fmt,
expr,
expr...)
formats the expression list expr, expr, ... using specifications
from the string fmt, then returns the formatted string. The
fmt string consists of conversion specifications which convert and
add the next expr to the string, and ordinary characters which
sprintf()
simply adds to the string. These conversion
specifications are similar to those used by the ANSI C standard.
Conversion specifications have the form
%[-][0][x][.y]c
where
In a string, the precision is the maximum number of characters to be printed from the string; in a number, the precision is the number of digits to be printed to the right of the decimal point in a floating point value. If x or y is- left justifies the field; default is right justification 0 leading zero prints numbers with leading zero x is the minimum field width y is the precision c is the conversion character
*
(asterisk), the minimum
field width or precision is the value of the next expr in the call
to sprintf()
.
The conversion character c is one of following:
The lowercased decimal integer i decimal integer o unsigned octal integer x,X unsigned hexadecimal integer u unsigned decimal integer f,F floating point e,E floating point (scientific notation) g,G the shorter ofe
andf
(suppresses non-significant zeros) c single character of an integer value; first character of string s string
x
prints alphabetic hex digits in lowercase
while the uppercase X
prints alphabetic hex digits in
uppercase. The other uppercase and lowercase pairs work similarly. = sub(
regexp,
repl,
string)
searches string for the first substring matching the extended
regular expression regexp, and replaces the substring with the
string repl. awk
replaces any ampersand
(&
) in repl with the substring of string
which matches regexp. You can suppress this special behavior by
preceding the ampersand with a backslash. If you omit string,
sub()
uses the current record instead. sub()
returns the number of substrings replaced (which is one if it found a
match, or zero otherwise).
= substr(
string,
offset,
len)
returns the substring of string that begins in position
offset and is at most len characters long. The first
character of the string has an offset equal to one. If you omit
len, substr()
returns the rest of string.
= tolower(
expr)
converts all letters in the string value of expr into lowercase
and returns the result. If you omit expr, tolower()
uses $0
instead.
= toupper(
expr)
converts all letters in the string value of expr into uppercase
and returns the result. If you omit expr, toupper()
uses $0
instead.
= system(
expr)
runs the string value of expr as a command. For example,
system("tail " $1)
calls the tail
command,
using the string value of $1
as the file that
tail
examines. The standard
command interpreter runs the command as discussed in the
PORTABILITY section, and the exit status
returned depends on that command interpreter.
A function definition can appear in the place of a patternfunction name(parameter-list) { statements }
{
action}
rule. The parameter-list contains any
number of normal (scalar) and array variables separated by commas. When you call
a function, awk
passes scalar arguments by value, and array
arguments by reference. The names specified in the parameter-list are
local to the function; all other names used in the function are global. You can
define local variables by adding them to the end of the parameter list as long
as no call to the function uses these extra parameters.
A function returns to its caller either when it performs the final statement in
the function, or when it reaches an explicit return
statement. The return value, if any, is specified in the
return
statement (see the
Actions section).
BEGIN
is a special pattern used to label actions that
awk
performs before reading any input records.
END
is a special pattern used to label actions that
awk
performs after reading all input records.
You can give a pattern range as
This range matches all lines from the line that matches pattern1 to the line that matches pattern2, inclusive. If you omit a pattern, or if the numeric value of the pattern is non-zero (true),pattern1,pattern2
awk
performs the resulting action for the line.
awk
considers a non-zero value true and a zero value false. A statement is
one of the following or any series of statements enclosed in braces.
The# expression statement, for example, assignment expression # if statement if (condition) statement [else statement] # while loop while (condition) statement # do-while loop do statement while (condition) # for loop for (expression1; condition; expression2) statement
for
statement is equivalent to:
Theexpression1 while (condition) { statement expression2 }
for
statement can also have the form
for (i in array) statement
awk
performs the statement once for each element in
array; on each repetition, the variable i contains the name of a
subscript of array, running through all the subscripts in an arbitrary
order. If array is multi-dimensional (has multiple subscripts), i
is expressed as a single string with the SUBSEP
character
separating the subscripts.
The statement
exits abreak
for
or a while
loop immediately.
stops the current iteration of acontinue
for
or
while
loop and begins the next iteration (if there is one).
terminates any processing for the current input record and immediately starts processing the next input record. Processing for the next record begins with the first appropriate rule.next
immediately goes to theexit[(expr)]
END
action if it exists; if there is no
END
action, or if awk
is already performing the
END
action, the awk
program terminates.
awk
sets the exit status of the program to the numeric value
of expr. If you omit (
expr)
, the exit
status is 0.
returns from the execution of a function. If you specify an expr, the function returns the value of the expression as its result; otherwise, the function result is undefined.return [expr]
deletes element i from the given array.delete array[i]
is described in the Output subsection.print expr, expr, ...
is also described in the Output subsection.printf fmt, expr, expr, ...
print
statement prints its arguments with only simple
formatting. If it has no arguments, it prints the current input record in its
entirety. awk
adds the output record separator
ORS
to the end of the output that each print
statement produces; when commas separate arguments in the
print
statement, the output field separator OFS
separates the corresponding output values. ORS
and OFS
are built-in variables, the values of which you can change by assigning them
strings. The default output record separator is a newline and the default output
field separator is a space.
The variable OFMT
gives the format of floating point numbers output
by print
. By default, the value is %.6g
; you
can change this value by assigning OFMT
a different string value.
OFMT
applies only to floating point numbers (that is, ones with
fractional parts).
The printf
statement formats its arguments using the
fmt argument. Formatting is the same as for the built-in function
sprintf()
. Unlike print
,
printf
does not add output separators automatically, giving
the program more precise control of the output.
The print
and printf
statements write to
the standard output. You can redirect output to a file or pipe as described
later.
If you add >
expr to a print
or
printf
statement, awk
treats the string
value of expr as a file name, and writes output to that file. Similarly,
if you add >>
expr, awk
appends
output to the current contents of the file. The distinction between
>
and >>
is only important for the first
print
to the file expr. Subsequent outputs to an
already open file append to what is there already.
To eliminate ambiguities, statements such as
are syntactically illegal. Use parentheses to resolve the ambiguity. If you addprint a > b c
|
expr to a print
or
printf
statement, awk
treats the string
value of expr as an executable command and runs it with the output from
the statement piped as input into the command.
As mentioned earlier, only a limited number of files and pipes can be open at
any time. To avoid going over the limit, use the close()
function
to close files and pipes when you no longer need them.
print
and printf
are also available as
functions with the same calling sequence, but no redirection.
outputs the contents of the fileawk '{print NR ":" $0}' input1
input1
with line numbers prepended
to each line.
The following is an example using var=
value on the
command line.
awk '{print NR SEP $0}' SEP=":" input1
awk
can also read the program script from a file as in the
command line:
which produces the same output when the fileawk -f addline.awk input1
addline.awk
contains
The following program appends all input lines starting with{print NR ":" $0}
January
to the file jan
(which may or may not exist already), and all lines
starting with February
or March
to the file
febmar
:
This program prints the total and average for the last column of each input line:/^January/ {print >> "jan"} /^February|^March/ {print >> "febmar"}
The next program interchanges the first and second fields of input lines:{s += $NF} END {print "sum is", s, "average is", s/NR}
The following example inserts line numbers so that output lines are left-aligned:{ tmp = $1 $1 = $2 $2 = tmp print }
The following example prints input records in reverse order (assuming sufficient memory):{printf "%-6d: %s\n", NR, $0}
The next program determines the number of lines starting with the same first field:{ a[NR] = $0 # index using record number } END { for (i = NR; i>0; --i) print a[i] }
The following program can be used to determine the number of lines in each input file:{ ++a[$1] # array indexed using the first field } END { # note output is in undefined order for (i in a) print a[i], "lines start with", i }
The following program illustrates how you can use a two dimensional array in{ ++a[FILENAME] } END { for (file in a) if (a[file] = = 1) print file, "has 1 line" else print file, "has", a[file], "lines" }
awk
. Assume the first field of each input record contains a
product number, the second field contains a month number, and the third field
contains a quantity (bought, sold, or whatever). The program generates a table
of products versus month.
As the following program reads in each line of input, it reports whether the line matches a pre-determined value:BEGIN {NUMPROD = 5} { array[$1,$2] += $3 } END { print "\t Jan\t Feb\tMarch\tApril\t May\t" \ "June\tJuly\t Aug\tSept\t Oct\t Nov\t Dec" for (prod = 1; prod <= NUMPROD; prod++) { printf "%-7s", "prod#" prod for (month = 1; month <= 12; month++){ printf "\t%5d", array[prod,month] } printf "\n" } }
The following example prints lines, the first and last fields of which are the same, reversing the order of the fields:function randint() { return (int((rand()+1)*10)) } BEGIN { prize[randint(),randint()] = "$100"; prize[randint(),randint()] = "$10"; prize[1,1] = "the booby prize" } { if (($1,$2) in prize) printf "You have won %s!\n", prize[$1,$2] }
The following program prints the input files from the command line. The$1= =$NF { for (i = NF; i > 0; --i) printf "%s", $i (i>1 ? OFS : ORS) }
infiles()
function first empties the passed array, and then fills
the array. Notice that the extra parameter i
of
infiles()
is a local variable.
Here is the standard recursive factorial function:function infiles(f,i) { for (i in f) delete f[i] for (i = 1; i < ARGC; i++) if (index(ARGV[i],"=") = = 0) f[i] = ARGV[i] } BEGIN { infiles(a) for (i in a) print a[i] exit }
The following program illustrates the use offunction fact(num) { if (num <= 1) return 1 else return num * fact(num - 1) } { print $0 " factorial is " fact($0) }
getline
with a pipe.
Here, getline
sets the current record from the output of the
wc
command. The program prints the
number of words in each input file.
function words(file, string) { string = "wc " file string | getline close(string) return ($2) } BEGIN { for (i=1; i<ARGC; i++) { fn = ARGV[i] printf "There are %d words in %s.", words(fn), fn } }
PATH
contains a list of directories that awk
searches
when looking for commands run by system
(expr), or
input and output pipes.
awk
program itself.
0
Successful completion.
1
Any of the following errors:
print
printf
END
action was not redirectedprintf
or
sprintf()
/
or %
) by zeroSYMTAB
must have exactly one indexsprintf()
string longer than allowed number of
characters\
in pattern\( \)
pairs[ ]
imbalance or syntax error( )
or \( \)
imbalance{ }
or \{ \}
imbalanceregex
errorawk
program terminates because of a call to
exit()
, the exit status is the value passed to exit()
.
awk
are dynamic,
limited only by memory restrictions of the target machine.
The maximum record size is guaranteed to be at least LINE_MAX
,
as returned by getconf
.
The maximum field size is guaranteed to be LINE_MAX
.
Input must be text files.
ord()
function is an extension to traditional implementations
of awk
. The toupper()
and tolower()
functions and the ENVIRON
array are in POSIX and the UNIX System V
Release 4 version of awk
. This version is a superset of New
AWK as described in The AWK Programming Language by Aho, Weinberger, and
Kernighan.
The standard command interpreter that the system()
function uses
and that awk
uses to run pipelines for getline
,
print
and printf
is system dependent. On
UNIX and POSIX-compliant systems, this interpreter is always
/bin/sh
.
The shell in use affects the error status that the system
function returns: sh
returns the exit
status of the run command.
regexp