Skip to content

Instantly share code, notes, and snippets.

@mshuler
Created August 13, 2010 15:47
Show Gist options
  • Save mshuler/523095 to your computer and use it in GitHub Desktop.
Save mshuler/523095 to your computer and use it in GitHub Desktop.
script to tail and strip irclogs for piping to espeak
#!/bin/sh
# script to tail and strip irclogs for piping to espeak:
# don't forget -t for a TTY if calling script remotely via ssh, ie:
# ssh -t host.example.com ~/bin/tailirclog_espeak.sh debian-devel | espeak
if [ ${1} ]; then
CHAN=${1}
LOG=$( find ${HOME}/irclogs/ -name \#*${1}.log )
if [[ ! -f ${LOG} ]]; then
echo; echo "cannot find logs for #${CHAN}"; echo
else
echo "Following IRC log for #${CHAN}"
# tail --follow and process:
# skip first 6 chars (time), NICK or ACTION (*), and ingore '-!-' lines
tail -n2 -F ${LOG} | sed -r 's/^.{6}.*(<.*> |\* )//;/-!-/d'
fi
else
echo; echo "$0 needs an irc channel name to follow"; echo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment