diff --git a/m1/perf/favg b/m1/perf/favg new file mode 100755 index 0000000..7495f15 --- /dev/null +++ b/m1/perf/favg @@ -0,0 +1,19 @@ +#!/usr/bin/perl +$sel = $ARGV[0]; +shift @ARGV; +for (@ARGV) { + $s = 0; + $n = 0; + open(FILE, $_) || die "$_: $!"; + while () { + $c = 0 if //; + if (/]*>([0-9.]+)/ ) { + $c++; + next unless $c == $sel; + $s += $1; + $n++; + } + } + close FILE; + print "$s/$n = ", $s/$n, "\n"; +}