AWK - Array Membership Operator
It is represented by in. It is used while accessing array elements. The following example prints array elements using this operator.
Example
[jerry]$ awk 'BEGIN {
arr[0] = 1; arr[1] = 2; arr[2] = 3; for (i in arr) printf "arr[%d] = %d\n", i, arr[i]
}'
On executing this code, you get the following result −
Output
arr[0] = 1 arr[1] = 2 arr[2] = 3
awk_operators.htm
Advertisements