#!/bin/sh # # Generate textual and visual statistics of the debianforum.de # # depends on: w3m, awk, (gnuplot) # # markus schnalke , 2015-01, License: CC0 url=http://debianforum.de/forum/index.php if [ $# -lt 1 -o $# -gt 2 ] ; then echo "Usage: dfde-stats.sh out.txt [out.png]" >&2 exit 1 fi w3m -dump "$url" | awk ' /[0-9] *Themen/ { ntopics = $1 } /[0-9] *Beiträge/ { nposts = $1 } /^ [^ ]/ { sub(/^ */, ""); sub(/ *$/, "") gsub(/ /, "_") name = $0 } /^$/ { if (!ntopics) { next } printf("%d\t%d\t%.2f\t%s\n", ntopics, nposts, nposts/ntopics, name) ntopics = nposts = name = 0 } ' >"$1" test $# -ne 2 && exit gnuplot <