Next: Patterns and Actions, Previous: Printing, Up: Top   [Contents][Index]

6 Expressions

Expressions are the basic building blocks of awk patterns and actions. An expression evaluates to a value that you can print, test, or pass to a function. Additionally, an expression can assign a new value to a variable or a field by using an assignment operator.

An expression can serve as a pattern or action statement on its own. Most other kinds of statements contain one or more expressions that specify the data on which to operate. As in other languages, expressions in awk can include variables, array references, constants, and function calls, as well as combinations of these with various operators.

Values    Constants, Variables, and Regular Expressions.
All Operators    gawk’s operators.
Truth Values and Conditions    Testing for true and false.
Function Calls    A function call is an expression.
Precedence    How various operators nest.
Locales    How the locale affects things.
Expressions Summary    Expressions summary.