Variables can be assigned a value with an = sign. For example:
FS = ","
Expressions using the operators +, -, /, and % (modulo) can be assigned to variables.
Arrays can be created with the split function (see below),
or they can simply be named in an assignment statement. ++, +=,
and -= are
used to increment or decrement an array, as in the C language. Array
elements can be subscripted with numbers (array[1],
..., array[n])
or with names. For example, to count the number of occurrences of a
pattern, you could use the following script:
/pattern/ {array["/pattern/"]++ } END { printarray["/pattern/"] }