Help Wikitravel grow by contributing to an article! Learn how.

User:IBobi/StatScript

From Wikitravel
< User:IBobi
Revision as of 19:32, 11 January 2013 by IBobi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

BEGIN {

 LIST="en fr ro de sv ja nl pt es pl it"
 split(LIST, list)
 for(i in list) {
   #print list[i]
   cmd = "wget -O " list[i] " 'http://wikitravel.org/wiki/" list[i] "/index.php?title=Special:Statistics&action=raw'; sleep 3"
   system(cmd) 
   ARGV[i]=list[i]
   n++
 }
 ARGC=++n

}

/total=/ { split($0, fields, ";")

          split(fields[2], values, "=")
          num[j++]=values[2]
          total+=values[2] }

END {

 CONVFMT="%.2f"
 print "|-"
 printf "| " strftime("%d %b %Y") " "
 for (i=0;i<j;i++) {
   printf "|| " num[i] " (" (100*num[i])/total "%) "
 }
 printf "|| " total

}

Variants

Actions

Destination Docents

In other languages