gno/usr.bin/awk/tests/array.awk
tribby ddb82cb2e0 Remaining files for awk 2.0 that were left out of the previous checkin.
Maybe someday I'll become adept at using cvs...
1998-04-07 17:06:53 +00:00

20 lines
334 B
Awk

# Read values into an array
$1 == "REMOVE" { delete value[$2]; next }
$1 == "RESET" {delete value; next}
$1 == "SKIP" {nextfile}
$1 == "PRINT" {printarray(value); next}
{ value[$1] = $2 }
END { printarray(value) }
function printarray(A, key) {
print "Values in array";
for (key in A) print " ",key,A[key];
print " ";
}