This paper describes the design and implementation of awk, a programming language which searches a set of files for patterns, and performs specified actions upon records or fields of records which match the patterns. Awk makes common data selection and transformation operations easy to express; for example, (Formula Presented.) is a complete awk program that prints all input lines whose length exceeds 72 characters. The program (Formula Presented.) prints each input line with the first field replaced by its logarithm. The program (Formula Presented.) prints all lines in which the first field is different from the first field of the previous line. Patterns may include boolean combinations of regular expressions and of relational operators on strings, numbers, fields, variables, and array elements. Actions may include: the same matching constructions as in patterns; arithmetic and string expressions and assignments; if‐else, while, and for statements; formatted output; and multiple output streams.
All Science Journal Classification (ASJC) codes
- Report generation