irclogs (491B) [raw]
1 #!/bin/sh 2 # irclogs -- small script to get only the messages from logs 3 set -e 4 die() { 5 echo "$*" 1>&2 6 exit 1 7 } 8 9 LOGS=/home/_soju/logs 10 11 [ -z "$1" ] && die "usage: $0 CHANNEL" 12 [ ! -d "$LOGS/$USER" ] && die "User $USER doesn't appear to have a soju account" 13 [ ! -d "$LOGS/$USER/irc.libera.chat/#$1" ] && die "channel #$1 doesn't have any logs" 14 15 # cd into the log dir as a cheap way to truncate output 16 cd "$LOGS/$USER/irc.libera.chat/#$1" 17 18 grep '^\[[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\] *<' *.log