Created
August 13, 2010 15:47
-
-
Save mshuler/523095 to your computer and use it in GitHub Desktop.
script to tail and strip irclogs for piping to espeak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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