in reply to Re: reset of match variables
in thread reset of match variables
Or even just this:
$SUM += /$regex/;
Update: Sorry, mine only counts the number of matches (like grep -c). To accumulate the values of matches, I still instinctively reach for (something like) this:
nawk '/([0-9]*)/{tot+=$1}END{print tot}' file
|
|---|