From 31492556364e74806a7d02f1115297dddd6e4a8f Mon Sep 17 00:00:00 2001
From: Bjørn Lindeijer <bjorn@lindeijer.nl>
Date: Tue, 16 Jun 2009 12:30:05 +0200
Subject: Made the statistics script a bit more easily configurable

I hope I didn't break it.
---
 stats.sh | 51 +++++++++++++++++++++++++++------------------------
 1 file 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
-- 
cgit v1.2.3-70-g09d2