diff options
Diffstat (limited to 'scripts/gen-stats')
-rwxr-xr-x | scripts/gen-stats | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/gen-stats b/scripts/gen-stats new file mode 100755 index 0000000..46148d4 --- /dev/null +++ b/scripts/gen-stats @@ -0,0 +1,34 @@ +#!/bin/sh + +gawk -v CC=$1 ' +@include "scripts/getcls.awk" + +function hndl(x) { + if (x == "/") + return + if (x ~ /[XO@]/) + have++ + cnt++ +} + +BEGIN { + CC = toupper(CC) +} + +FILENAME == "data/coins" && $1 == CC && $2 != "start" { + split($0, xs) + for (i = 2; i < length(xs); i++) + hndl(xs[i]) +} + +FILENAME == "data/ccs" && $1 == CC { + gsub(/([A-Z]{2} [0-9]{4}( [A-Za-z]+)?|\t.*)/, " ") + split($0, xs) + for (i = 1; i <= length(xs); i++) + hndl(xs[i]) +} + +END { + printf "%d/%d (%d%%)\n", have, cnt, have / cnt * 100 +} +' data/coins data/ccs |