Go to the previous, next section.
awk
Language
This manual describes the GNU implementation of awk
, which is patterned
after the POSIX specification. Many awk
users are only familiar
with the original awk
implementation in Version 7 Unix, which is also
the basis for the version in Berkeley Unix (through 4.3--Reno). This chapter
briefly describes the evolution of the awk
language.
The awk
language evolved considerably between the release of
Version 7 Unix (1978) and the new version first made widely available in
System V Release 3.1 (1987). This section summarizes the changes, with
cross-references to further details.
awk
Statements versus Lines).
return
statement
(see section User-defined Functions).
delete
statement (see section The delete
Statement).
do
-while
statement
(see section The do
-while
Statement).
atan2
, cos
, sin
, rand
and
srand
(see section Numeric Built-in Functions).
gsub
, sub
, and match
(see section Built-in Functions for String Manipulation).
close
, which closes an open file, and
system
, which allows the user to execute operating system
commands (see section Built-in Functions for Input/Output).
ARGC
, ARGV
, FNR
, RLENGTH
, RSTART
,
and SUBSEP
built-in variables (see section Built-in Variables).
awk
programs (see section Operator Precedence (How Operators Nest)).
FS
(see section Specifying how Fields are Separated), and as the
third argument to the split
function
(see section Built-in Functions for String Manipulation).
getline
function
(see section Explicit Input with getline
).
BEGIN
and END
rules
(see section BEGIN
and END
Special Patterns).
The System V Release 4 version of Unix awk
added these features
(some of which originated in gawk
):
ENVIRON
variable (see section Built-in Variables).
awk
).
awk
).
srand
built-in function
(see section Numeric Built-in Functions).
toupper
and tolower
built-in string functions
for case translation
(see section Built-in Functions for String Manipulation).
printf
function
(see section Using printf
Statements for Fancier Printing).
"%*.*d"
)
in the argument list of the printf
function
(see section Using printf
Statements for Fancier Printing).
/foo/
as expressions, where
they are equivalent to use of the matching operator, as in $0 ~
/foo/
(see section Constant Expressions).
awk
The POSIX Command Language and Utilities standard for awk
introduced the following changes into the language:
CONVFMT
for controlling the conversion of numbers
to strings (see section Conversion of Strings and Numbers).
gawk
not in POSIX awk
The GNU implementation, gawk
, adds these features:
AWKPATH
environment variable for specifying a path search for
the `-f' command line option
(see section Invoking awk
).
gawk
specific features available via the `-W'
command line option (see section Invoking awk
).
ARGIND
variable, that tracks the movement of FILENAME
through ARGV
. (see section Built-in Variables).
ERRNO
variable, that contains the system error message when
getline
returns -1, or when close
fails.
(see section Built-in Variables).
IGNORECASE
variable and its effects
(see section Case-sensitivity in Matching).
FIELDWIDTHS
variable and its effects
(see section Reading Fixed-width Data).
next file
statement for skipping to the next data file
(see section The next file
Statement).
systime
and strftime
built-in functions for obtaining
and printing time stamps
(see section Functions for Dealing with Time Stamps).
awk
).
awk
).
Go to the previous, next section.