Go to the previous, next section.
awk
statements attached to a rule. If the rule's
pattern matches an input record, the awk
language executes the
rule's action. Actions are always enclosed in curly braces.
See section Overview of Actions.
awk
Assembler
awk
scripts. It is thousands of lines long, including
machine descriptions for several 8-bit microcomputers.
It is a good example of a
program that would have been better written in another language.
awk
expression that changes the value of some awk
variable or data object. An object that you can assign to is called an
lvalue. See section Assignment Expressions.
awk
Language
awk
programs are written.
awk
Program
awk
program consists of a series of patterns and
actions, collectively known as rules. For each input record
given to the program, the program's rules are all processed in turn.
awk
programs may also contain function definitions.
awk
Script
awk
program.
awk
language provides built-in functions that perform various
numerical, time stamp related, and string computations. Examples are
sqrt
(for the square root of a number) and substr
(for a
substring of a string). See section Built-in Functions.
ARGC
, ARGIND
, ARGV
, CONVFMT
, ENVIRON
,
ERRNO
, FIELDWIDTHS
, FILENAME
, FNR
, FS
,
IGNORECASE
, NF
, NR
, OFMT
, OFS
, ORS
,
RLENGTH
, RSTART
, RS
, and SUBSEP
,
are the variables that have special
meaning to awk
. Changing some of them affects awk
's running
environment. See section Built-in Variables.
awk
programming language has C-like syntax, and this manual
points out similarities between awk
and C when appropriate.
pic
that reads descriptions of molecules
and produces pic
input for drawing them. It was written by
Brian Kernighan, and is available from netlib@research.att.com
.
awk
statements, enclosed in curly braces. Compound
statements may be nested.
See section Control Statements in Actions.
expr1 ? expr2 : expr3
. The expression
expr1 is evaluated; if the result is true, the value of the whole
expression is the value of expr2 otherwise the value is
expr3. In either case, only one of expr2 and expr3
is evaluated. See section Conditional Expressions.
awk
program, and cannot be changed doing
its execution. See section How to Use Regular Expressions.
(a < b)
.
Comparison expressions are used in if
, while
, and for
statements, and in patterns to select which input records to process.
See section Comparison Expressions.
awk
for delimiting actions, compound statements, and function
bodies.
"foo"
, but it may also be an expression whose value may vary.
See section How to Use Regular Expressions.
awk
reads an input record, it splits the record into pieces
separated by whitespace (or by a separator regexp which you can
change by setting the built-in variable FS
). Such pieces are
called fields. If the pieces are of fixed length, you can use the built-in
variable FIELDWIDTHS
to describe their lengths.
See section How Input is Split into Records.
printf
statement. Also, data conversions from numbers to strings
are controlled by the format string contained in the built-in variable
CONVFMT
. See section Format-Control Letters.
awk
has a number of built-in
functions, and also allows you to define your own.
See section Built-in Functions.
Also, see section User-defined Functions.
gawk
awk
.
awk
. Usually, an awk
input
record consists of one line of text.
See section How Input is Split into Records.
awk
language, a keyword is a word that has special
meaning. Keywords are reserved and may not be used as variable names.
awk
's keywords are:
if
,
else
,
while
,
do...while
,
for
,
for...in
,
break
,
continue
,
delete
,
next
,
function
,
func
,
and exit
.
awk
, a field designator can also be used as an
lvalue.
gawk
implementation uses double
precision floating point to represent numbers.
awk
which input records are interesting to which
rules.
A pattern is an arbitrary conditional expression against which input is tested. If the condition is satisfied, the pattern is said to match the input record. A typical pattern might compare the input record against a regular expression. See section Patterns.
awk
users is P1003.2, the Command Language and Utilities standard.
awk
to process, or it can
specify single lines. See section Patterns.
You can redirect the output of the print
and printf
statements
to a file or a system command, using the `>', `>>', and `|'
operators. You can redirect input to the getline
statement using
the `<' and `|' operators.
See section Redirecting Output of print
and printf
.
awk
, regexps are
used in patterns and in conditional expressions. Regexps may contain
escape sequences. See section Regular Expressions as Patterns.
awk
program, that specifies how to process single
input records. A rule consists of a pattern and an action.
awk
reads an input record; then, for each rule, if the input record
satisfies the rule's pattern, awk
executes the rule's action.
Otherwise, the rule does nothing for that input record.
gawk
, instead of being handed
directly to the underlying operating system. For example, `/dev/stdin'.
See section Standard I/O Streams.
awk
language, and may contain escape sequences.
See section Constant Expressions.
Go to the previous, next section.