summaryrefslogtreecommitdiffhomepage
path: root/scripts/gen-stats
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-07-18 22:01:30 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-07-18 22:01:30 +0200
commit07ae048ae71387ad39e07841d1c3eb76ce0736ee (patch)
tree1dd4ac8c4d9b6d8dfc657439c346a344679149f8 /scripts/gen-stats
parentb281398a897736aef922468107f419e3590388a4 (diff)
Add completion percentages to each page
Diffstat (limited to 'scripts/gen-stats')
-rwxr-xr-xscripts/gen-stats34
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