slain
dirt31/bin/slain · 826 B
From the archive dirt31.tar.gz
Download the archive « Back to the archive contents
#!/bin/nawk -f
#
# Make a table showing who has been killed the most and who has
# killed the most number of times in the files (syslog-format) given
# as arguments.
#
# A typical usage is 'slain syslog Deaths' if you use the 'fixlog' program
# to record all deaths in the Deaths file.
#
# -Nicknack
BEGIN { sort = "sort +1 -nr" }
/ slain / && $5 != "The" { # Don't count the killing of aliased mobiles
++victim[$5]
++slayer[$NF]
}
END { print "Name\t Deaths\n"
for( i in victim )
if ((x = victim[i]) > 1) {
printf("%-12s %d\n", i, x) | sort
}
close(sort)
print "\n\nName\t Kills\n"
for( i in slayer )
if ((x = slayer[i]) > 1) {
printf("%-12s %d\n", i, x) | sort
}
}