Anyone know how I can reverse the order of the below script's output to show latest match first using bash?
Here is the line of script I use to get the page found here
"http://basementunderground.net/box/"
one long line in the index file
---------------------------------------
grep -A 6 Player: /pathto/scorelog.txt > /pathto/boxscore && cat /pathto/boxscore | sed 's/New Match//g' > /pathto/boxscore2 && cat /pathto/boxscore2 | sed 's/New Round//g' > /pathto/boxscore3 && cat /pathto/boxscore3 | sed '/core dumped/d' > /pathto/boxscore4 && cat /pathto/boxscore4 | sed '/was awarded/d' && rm -r -f /pathto/boxscore /pathto/boxscore2 /pathto/boxscore3
---------------------------------------
I am aware Perl and PHP can do this easier, but I am learning bash scripting at the moment, and making the stats pages using bash/cgi is helping me a great deal.
help with bash cgi
this works
this works
here it is http://basementunderground.net/boxscores/
#!/bin/bash
echo "Content-type: text/html"
echo ""
cat /path/to/htdocs/hdr
cat /path/to/htdocs/links
echo ""
echo "<b>boxscores</b>"
echo "--" > /path/tol/htdocs/boxscores/box && echo -n "---------" && grep -w -A 9 "Overall Winner:" /path/to/.armagetronad/var/scorelog.txt | sed '/New Match/d' | sed '/for 1 points./d' | sed '/New Round/d' | tr '<' '-' | tr '>' '-' | sed '/Final Scores:/d' >> /path/to/htdocs/boxscores/box && tac -s'--' /path/to/htdocs/boxscores/box | sed '/--/d' | sed 's/Overall Winner: /Overall Winner: <b><u>/' | sed 's/ with 10 points./<\/u><\/b> with 10 points./' | sed 's/ with 11 points./<\/u><\/b> with 11 points./' | sed 's/ with 12 points./<\/u><\/b> with 12 points./' | sed 's/ after 25 rounds./<\/u><\/b> after 25 rounds./' | sed 's/ after 26 rounds./<\/u><\/b> after 26 rounds./'
cat /path/to/htdocs/ftr
exit 0
here it is http://basementunderground.net/boxscores/
#!/bin/bash
echo "Content-type: text/html"
echo ""
cat /path/to/htdocs/hdr
cat /path/to/htdocs/links
echo ""
echo "<b>boxscores</b>"
echo "--" > /path/tol/htdocs/boxscores/box && echo -n "---------" && grep -w -A 9 "Overall Winner:" /path/to/.armagetronad/var/scorelog.txt | sed '/New Match/d' | sed '/for 1 points./d' | sed '/New Round/d' | tr '<' '-' | tr '>' '-' | sed '/Final Scores:/d' >> /path/to/htdocs/boxscores/box && tac -s'--' /path/to/htdocs/boxscores/box | sed '/--/d' | sed 's/Overall Winner: /Overall Winner: <b><u>/' | sed 's/ with 10 points./<\/u><\/b> with 10 points./' | sed 's/ with 11 points./<\/u><\/b> with 11 points./' | sed 's/ with 12 points./<\/u><\/b> with 12 points./' | sed 's/ after 25 rounds./<\/u><\/b> after 25 rounds./' | sed 's/ after 26 rounds./<\/u><\/b> after 26 rounds./'
cat /path/to/htdocs/ftr
exit 0