[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
awk
statements attached to a rule. If the rule's
pattern matches an input record, awk
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 eight-bit microcomputers.
It is a good example of a
program that would have been better written in another language.
awf
)
awk
and sh
.
awk
expression that changes the value of some awk
variable or data object. An object that you can assign to is called an
lvalue. The assigned values are called rvalues.
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.
ksh
, pdksh
, zsh
) are
generally upwardly compatible with the Bourne shell.
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
, RT
, and SUBSEP
,
are the variables that have special meaning to awk
.
Changing some of them affects awk
's running environment.
Several of these variables are specific to gawk
.
See section 10. Built-in Variables.
awk
programming language has C-like syntax, and this Info file
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 in awk
by Brian Kernighan and Jon Bentley, and is available from
netlib@research.bell-labs.com.
awk
statements, enclosed in curly braces. Compound
statements may be nested.
See section Control Statements in Actions.
if
, while
, do
,
and for
statements, and in patterns to select which input records to process.
See section Variable Typing and Comparison Expressions.
awk
for delimiting actions, compound statements, and function
bodies.
awk
stores numeric values. It is the C type double
.
"foo"
, but it may also be an expression whose value can vary.
See section Using Dynamic Regexps.
=
val, that each
program has available to it. Users generally place values into the
environment in order to provide information to various programs. Typical
examples are the environment variables HOME
and PATH
.
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 Specifying How Fields are Separated,
and also see
See section Reading Fixed-width Data.
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,
and User-defined Functions.
gawk
awk
.
gawk
and its source
code may be distributed. (see section GNU GENERAL PUBLIC LICENSE)
0
-9
and
A
-F
, with `A'
representing 10, `B' representing 11, and so on up to `F' for 15.
Hexadecimal numbers are written in C using a leading `0x',
to indicate their base. Thus, 0x12
is 18 (one times 16 plus 2).
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.
gawk
's keywords are:
BEGIN
,
END
,
if
,
else
,
while
,
do...while
,
for
,
for...in
,
break
,
continue
,
delete
,
next
,
nextfile
,
function
,
func
,
and exit
.
awk
. Often called Boolean
expressions, after the mathematician who pioneered this kind of
mathematical logic.
awk
, a field designator can also be used as an
lvalue.
awk
programs by placing two double-quote characters next to
each other (""
). It can appear in input data by having two successive
occurrences of the field separator appear next to each other.
gawk
implementation uses double
precision floating point to represent numbers.
Very old awk
implementations use single precision floating
point.
0
-7
.
Octal numbers are written in C using a leading `0',
to indicate their base. Thus, 013
is 11 (one times 8 plus 3).
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 Pattern Elements.
awk
users is
IEEE Standard for Information Technology, Standard 1003.2-1992,
Portable Operating System Interface (POSIX) Part 2: Shell and Utilities.
Informally, this standard is often referred to as simply "P1003.2."
awk
program. Special care must be
taken when naming such variables and functions.
See section Naming Library Function Global Variables.
awk
to process, or it can
specify single lines. See section Pattern Elements.
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
,
and Explicit Input with getline
.
awk
, regexps are
used in patterns and in conditional expressions. Regexps may contain
escape sequences. See section Regular Expressions.
/foo/
. This regular expression is chosen
when you write the awk
program, and cannot be changed doing
its execution. See section How to Use Regular Expressions.
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.
awk
, essentially every expression has a value. These values
are rvalues.
sed
awk
logical operators `&&' and `||'.
If the value of the entire expression can be deduced from evaluating just
the left-hand side of these operators, the right-hand side will not
be evaluated
(see section Boolean Expressions).
awk
to store
numeric values. It is the C type float
.
gawk
, instead of being handed
directly to the underlying operating system. For example, `/dev/stderr'.
See section Special File Names in gawk
.
awk
language, and may contain escape sequences.
See section 4.2 Escape Sequences.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |