#!/bin/sh # IRC nick stats script # prints how many lines each user has said # polprog 2018 messageregex='\(<[ @+].*>\)\|\(* \(.*\)\)' printf "IRC LOG STATS:\n" printf "\tMSGs\tNICK\n" grep -a "${messageregex}" $1 | # show messages (filter out Joins/parts/quits/client messages), -a to suspress "Binary file matches ...." message sed -e 's/<[ \@+]\([^ <>]*\)>/\1/; s/* \(.*\)/\1/' | # drop prefixes and angle brackets, remove * from ACTIONs awk '{ print $2}' | # print just the nick sort | uniq -c | sort -rg | awk '{print "\t" $1 "\t" $2}'