summaryrefslogtreecommitdiffhomepage
path: root/scripts/gen-stats
blob: 46148d41bdcfea61740e742d52f7902ebfad1266 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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