Wikipedia:List of Wikipedians by featured article nominations/script
From Wikipedia, the free encyclopedia
This is the script I currently run to produce the content of Wikipedia:List of Wikipedians by featured article nominations from the by year articles (which are updated separately). -- Rick Block (talk) 21:51, 16 July 2006 (UTC)
#!/bin/bash # get all the articles nominated by year if [ "$1" = "" ]; then for YEAR in 2006 2005 2004 2003; do /usr/bin/curl "http://en.wikipedia.org/w/index.php?title=Wikipedia:Featured_articles_nominated_in_${YEAR}&action=raw" echo done >fasbyyear fi cat fasbyyear| awk ' function nomd(nom, article) { sub("^ *","",nom) sub(" *$","",nom) sub("^ *","",article) sub(" *$","",article) user = nom if (sub("\\|.*]]","",user) > 0) { sub("^..[uU][sS][eE][rR]:","",user) } if (fulluser[user] == "") { fulluser[user] = nom } if (sub("^'"''"'*\\[","[",article) > 0) { sub("'"'"'* *$","",article) } noms[user] = noms[user] "#" article nomcount[user] = nomcount[user] + 1 } BEGIN { FS="\\|\\|" } /^\|\|/ { if ($4 ~ /]] & /) { split($4,multinoms," & ") for (nom in multinoms) { nomd(multinoms[nom],$2) } } else { nomd($4,$2) } } END { for (nom in nomcount) { if (nom != "") { print nomcount[nom] "#" fulluser[nom] noms[nom] } } } ' | sort -t'#' +0rn +1f| awk ' BEGIN { FS="#" } { print "|-" print "| " $2 numarts = 0 for ( i=3; i<=NF; i=i+1) { sub("\\|.*]]","]]",$i) numarts = numarts + 1 if (numarts > 20) { printf "|-\n||\n" numarts = 1 } sub("]] *$","",$i) print "| " $i "|★]]" } }'