www.delorie.com/gnu/docs/gawk/gawk_74.html   search  
Buy the book!

The GNU Awk User's Guide

[ < ] [ > ]   [ << ] [ 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 include variables, array references, constants, and function calls, as well as combinations of these with various operators.

6.1 Constant Expressions  String, numeric and regexp constants.
6.2 Using Regular Expression Constants  When and how to use a regexp constant.
6.3 Variables  Variables give names to values for later use.
6.4 Conversion of Strings and Numbers  The conversion of strings to numbers and vice versa.
6.5 Arithmetic Operators  Arithmetic operations (`+', `-', etc.)
6.6 String Concatenation  Concatenating strings.
6.7 Assignment Expressions  Changing the value of a variable or a field.
6.8 Increment and Decrement Operators  Incrementing the numeric value of a variable.
6.9 True and False in awk  What is "true" and what is "false".
6.10 Variable Typing and Comparison Expressions  How variables acquire types and how this affects comparison of numbers and strings with
                                `<', etc.
6.11 Boolean Expressions  Combining comparison expressions using boolean operators `||' ("or"), `&&'
                                ("and") and `!' ("not").
6.12 Conditional Expressions  Conditional expressions select between two subexpressions under control of a third subexpression.
6.13 Function Calls  A function call is an expression.
6.14 Operator Precedence (How Operators Nest)  How various operators nest.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003