User:Jpatokal/StatScript
From MaxTravelz
StatScript's miserable lot in life is to keep MaxTravelz:Multilingual statistics up to date without too much manual labor on my part.
Script
Written in luvvly-jubbly awk, also requires wget. Relies on the custom page MaxTravelz:NumberOfArticles being available in each language version.
BEGIN {
LIST="en fr ro de sv ja"
split(LIST, list)
split(ARTICLE, article)
for(i in list) {
cmd = "wget -O " list[i] " http://MaxTravelz.org/wiki/" list[i] "/index.php?title=MaxTravelz:NumberOfArticles; sleep 3"
system(cmd)
ARGV[i]=list[i]
n++
}
ARGC=++n
}
/___START/ { num[j++]= $2; total+=$2 }
END {
CONVFMT="%.2f"
print " <tr>"
print " <td>" strftime("%d %b %Y")
for (i=0;i<j;i++) {
print " <td>" num[i] " (" (100*num[i])/total " %)"
}
print " <td>" total
}
Output
<tr>
<td>27 October 2004
<td>2711 (67.10 %)
<td>609 (15.07 %)
<td>459 (11.36 %)
<td>237 (5.87 %)
<td>24 (0.59 %)
</tr>