Go to the previous, next section.
awkstatements attached to a rule. If the rule's pattern matches an input record, the
awklanguage executes the rule's action. Actions are always enclosed in curly braces. See section Overview of Actions.
awkscripts. 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.
awkexpression that changes the value of some
awkvariable or data object. An object that you can assign to is called an lvalue. See section Assignment Expressions.
awkprograms are written.
awkprogram 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.
awkprograms may also contain function definitions.
awklanguage 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.
SUBSEP, are the variables that have special meaning to
awk. Changing some of them affects
awk's running environment. See section Built-in Variables.
awkprogramming language has C-like syntax, and this manual points out similarities between
awkand C when appropriate.
picthat reads descriptions of molecules and produces
picinput for drawing them. It was written by Brian Kernighan, and is available from
awkstatements, 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.
awkprogram, and cannot be changed doing its execution. See section How to Use Regular Expressions.
(a < b). Comparison expressions are used in
forstatements, and in patterns to select which input records to process. See section Comparison Expressions.
awkfor 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.
awkreads 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
FIELDWIDTHSto describe their lengths. See section How Input is Split into Records.
printfstatement. 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.
awkhas 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.
awk. Usually, an
awkinput record consists of one line of text. See section How Input is Split into Records.
awklanguage, a keyword is a word that has special meaning. Keywords are reserved and may not be used as variable names.
awk's keywords are:
awk, a field designator can also be used as an lvalue.
gawkimplementation uses double precision floating point to represent numbers.
awkwhich 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.
awkusers is P1003.2, the Command Language and Utilities standard.
awkto process, or it can specify single lines. See section Patterns.
You can redirect the output of the
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
awk, regexps are used in patterns and in conditional expressions. Regexps may contain escape sequences. See section Regular Expressions as Patterns.
awkprogram, that specifies how to process single input records. A rule consists of a pattern and an action.
awkreads an input record; then, for each rule, if the input record satisfies the rule's pattern,
awkexecutes 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.
awklanguage, and may contain escape sequences. See section Constant Expressions.
Go to the previous, next section.