Skip to content

Instantly share code, notes, and snippets.

@scottwalters
Created November 7, 2022 03:40
Show Gist options
  • Save scottwalters/3d62d8418ef70a61c08918af68d992e3 to your computer and use it in GitHub Desktop.
Save scottwalters/3d62d8418ef70a61c08918af68d992e3 to your computer and use it in GitHub Desktop.
#!/bin/sh
LINES=17
PLAYERS=/home/ah/players/
#while true;do
cd $PLAYERS
echo "-----------------------------------------------------------------------------"
echo -n 'Number of active players: '
echo `ls -1 *.o | wc | awk '{ print $1}'`
echo 'List of top players as of: ' `date`
echo " Level 20 with 10 quests solved is Wizard"
echo "-----------------------------------------------------------------------------"
echo ""
echo "Name Lev Hours Name Lev Hours Name Lev Hours"
echo ""
egrep '^level |^cap_name |^age |^experience ' *.o | sort -r | sed -e 's/\.o:/ /' -e 's/\"//g' |
awk '
$2=="level" { level = $3; }
$2=="cap_name" { name = $3; }
$2=="experience" { experience = $3; }
$2=="age" { if ( level < 21 ) printf("%-11s %2d %09d %3d\n", name, level, experience, $3/30/60);
age = 0; name = "XX"; }' |
grep -v -e '[A-Z][a-z]*test ' |
sort -s -r -n -k 3 |
sort -s -r -n -k 2 |
cut -c 1-15,26-100 |
pr -l$LINES -t -3 -w 80 --expand-tabs=8 --sep-string=' ' |
expand -t 8 |
head -$LINES
# pr despite all of the args still insists on inserting tabs, which break formatting when viewed on the MUD,
# but thankfully expand exists to remove tabs with the correct amount of space.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment