[plain]#!/bin/bash
# Get PrimeGrid race stats. Optional argument is team name.
# Enter the race ID (from its stats URLs) here:
chal=2010_3
if [ "$1" == "" ] ; then
team="TeAm AnandTech"
else
team="$1"
fi
echo Stats for team $team
echo [b]Rank[/b]__[b]Credits[/b]___[b][url=http://www.primegrid.com/challenge/$chal/top_users.html]Username[/url][/b]
links2 -only-proxies 0 -http-proxy '' -dump http://www.primegrid.com/challenge/$chal/top_users.html | grep "$team" | sed -e "s/^ *\([0-9][0-9]*\) */\t\1\t/;s/ */\t/g" | awk -F'\t' 'BEGIN { OFS="\t"}{print $2, $5, $3}' | sed -e "s/\t/___/g;s/\([0-9]\)\.[0-9]* */\1/;s/^\([0-9]\)_/\1___/;s/^\([0-9][0-9]\)_/\1__/;s/\(_[0-9]\{1,6\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,5\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,4\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,3\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,2\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,1\}_*\)\([^_0-9]\)/\1_\2/"
echo
echo [b]Rank[/b]__[b]Credits[/b]___[b][url=http://www.primegrid.com/challenge/$chal/top_teams.html]Team[/url][/b]
links2 -only-proxies 0 -http-proxy '' -dump http://www.primegrid.com/challenge/$chal/top_teams.html | grep -A3 -B3 "$team" | grep "^ *[0-9]" | sed -e "s/ */\t/g;s/\(Texas\|Epsilon\) \([0-9]\)/\1\t\2/" | awk -F'\t' 'BEGIN { OFS="\t"}{print $2, $4, $3}' | sed -e "s/\t/___/g;s/\([0-9]\)\.[0-9]* */\1/;s/^\([0-9]\)_/\1___/;s/^\([0-9][0-9]\)_/\1__/;s/\(_[0-9]\{1,6\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,5\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,4\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,3\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,2\}_*\)\([^_0-9]\)/\1_\2/;s/\(_[0-9]\{1,1\}_*\)\([^_0-9]\)/\1_\2/;s/\($team\)/[b]\1[\/b]/"[/plain]