Sum Matching Group in Perl

From EggeWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Perl script to find a number in matching lines and report the sum.

<geshi lang="perl"> perl -ne '$sum += $1 if /in (.*) seconds/; END { print $sum }' </geshi>