A.1 Major Changes Between V7 and SVR3.1
The awk
language evolved considerably between the release of
Version 7 Unix (1978) and the new version that was first made generally available in
System V Release 3.1 (1987). This section summarizes the changes, with
cross-references to further details:
-
The requirement for ‘;’ to separate rules on a line
(see section
awk
Statements Versus Lines).
-
User-defined functions and the
return
statement
(see section User-Defined Functions).
-
The
delete
statement (see section The delete
Statement).
-
The
do
-while
statement
(see section The do
-while
Statement).
-
The built-in functions
atan2()
, cos()
, sin()
, rand()
, and
srand()
(see section Numeric Functions).
-
The built-in functions
gsub()
, sub()
, and match()
(see section String-Manipulation Functions).
-
The built-in functions
close()
and system()
(see section Input/Output Functions).
-
The
ARGC
, ARGV
, FNR
, RLENGTH
, RSTART
,
and SUBSEP
built-in variables (see section Built-in Variables).
-
Assignable
$0
(see section Changing the Contents of a Field).
-
The conditional expression using the ternary operator ‘?:’
(see section Conditional Expressions).
-
The expression ‘index-variable in array’ outside of
for
statements (see section Referring to an Array Element).
-
The exponentiation operator ‘^’
(see section Arithmetic Operators) and its assignment operator
form ‘^=’ (see section Assignment Expressions).
-
C-compatible operator precedence, which breaks some old
awk
programs (see section Operator Precedence (How Operators Nest)).
-
Regexps as the value of
FS
(see section Specifying How Fields Are Separated) and as the
third argument to the split()
function
(see section String-Manipulation Functions), rather than using only the first character
of FS
.
-
Dynamic regexps as operands of the ‘~’ and ‘!~’ operators
(see section How to Use Regular Expressions).
-
The escape sequences ‘\b’, ‘\f’, and ‘\r’
(see section Escape Sequences).
(Some vendors have updated their old versions of
awk
to
recognize ‘\b’, ‘\f’, and ‘\r’, but this is not
something you can rely on.)
-
Redirection of input for the
getline
function
(see section Explicit Input with getline
).
-
Multiple
BEGIN
and END
rules
(see section The BEGIN
and END
Special Patterns).
-
Multidimensional arrays
(see section Multidimensional Arrays).