Join David D. Levine for an in-depth discussion in this video Working with operators and arrays, part of AWK Essential Training.
- View Offline
…Like most programming languages, AWK uses operators, the same ones…as the C programming language, to perform mathematical and comparison operations.…Plus and minus, multiplication, asterisk, and division, slash, work as you'd expect.…The modulo operator gives the remainder after…dividing the first argument by the second.…The power operator, caret, gives the result of…raising the first argument to the second one's power.…For example 2 caret 3 equals 8.…The increment operator plus plus increases the numeric value of…its argument, which must be a modifiable variable, by one.…
For example, if the value of a is 3, a++ increases it to 4.…Similarly, the decrement operator, minus minus, decreases the value by one.…For example, if a is 3, a-- decreases it to 2.…These operators can be used before or after or argument, which both had the…same effect on the argument but return a different value if used in an expression.…Putting the increment or decrement operator before…the variable returns the variable's new value.…
In this course, award-winning author and teacher David D. Levine shows you how to use AWK to read and write data in a variety of formats, produce reports, and automate repetitive tasks. He reviews the nuts and bolts of the language, such as field separators, pattern matching, variables, operators, expressions, and control structures; functions available for manipulating data; and integration with other programs like Excel.
- What is AWK?
- Writing an AWK program
- Working with records, fields, patterns, and actions
- Specifying field and record separators with variables
- Using built-in and user-defined variables
- Building control structures
- Formatting output
- Manipulating string data with functions
- Scripting with AWK