summaryrefslogtreecommitdiff
path: root/stats.sh
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-06-16 12:30:05 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-06-16 12:33:53 +0200
commit31492556364e74806a7d02f1115297dddd6e4a8f (patch)
tree501971e52440b196afb338018fe546352c47d2f5 /stats.sh
parent88daad76761607c8f5e1fb0731bf53653175bbef (diff)
downloadtmwa-31492556364e74806a7d02f1115297dddd6e4a8f.tar.gz
tmwa-31492556364e74806a7d02f1115297dddd6e4a8f.tar.bz2
tmwa-31492556364e74806a7d02f1115297dddd6e4a8f.tar.xz
tmwa-31492556364e74806a7d02f1115297dddd6e4a8f.zip
Made the statistics script a bit more easily configurable
I hope I didn't break it.
Diffstat (limited to 'stats.sh')
-rwxr-xr-xstats.sh51
1 files changed, 27 insertions, 24 deletions
diff --git a/stats.sh b/stats.sh
index a50c499..9ea021b 100755
--- a/stats.sh
+++ b/stats.sh
@@ -1,41 +1,44 @@
#!/bin/bash
-:> ~/public_html/stats/top-money.txt
-(echo "TOP 50 RICHEST PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+ATHENATXT="save/athena.txt"
+DEST="$HOME/public_html/stats"
+
+:> ${DEST}/top-money.txt
+(echo "TOP 50 RICHEST PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); sub(/ *[0-9]+$/,"",$6);print $6,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-money.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-money.txt
-:> ~/public_html/stats/top-highest-level.txt
-(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+:> ${DEST}/top-highest-level.txt
+(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); print $3,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-highest-level.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-highest-level.txt
-:> ~/public_html/stats/top-highest-str.txt
-(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+:> ${DEST}/top-highest-str.txt
+(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); sub(/^[0-9]+[[:space:]]*/,"",$9);print $9,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-highest-str.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-highest-str.txt
-:> ~/public_html/stats/top-highest-agi.txt
-(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+:> ${DEST}/top-highest-agi.txt
+(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); print $10,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-highest-agi.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-highest-agi.txt
-:> ~/public_html/stats/top-highest-vit.txt
-(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+:> ${DEST}/top-highest-vit.txt
+(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); print $11,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-highest-vit.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-highest-vit.txt
-:> ~/public_html/stats/top-highest-int.txt
-(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+:> ${DEST}/top-highest-int.txt
+(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); print $12,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-highest-int.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-highest-int.txt
-:> ~/public_html/stats/top-highest-dex.txt
-(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+:> ${DEST}/top-highest-dex.txt
+(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); print $13,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-highest-dex.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-highest-dex.txt
-:> ~/public_html/stats/top-highest-luk.txt
-(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat tmwserver/save/athena.txt \
+:> ${DEST}/top-highest-luk.txt
+(echo "TOP 50 HIGHEST LEVEL PLAYERS"; echo ""; cat ${ATHENATXT} \
| awk -F , '{sub(/^[0-9] */,"",$2);sub(/ *[0-9]$/,"",$2); sub(/[[:space:]]*[0-9]+$/,"",$14);print $14,$2}' \
-| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ~/public_html/stats/top-highest-luk.txt
+| sort -nr | head -n 50 | awk '{first=$1;$1="";print $0, "("first")"}' | nl -s ". "; echo ""; echo "Generated at `date`") >> ${DEST}/top-highest-luk.txt