Skip to content

Instantly share code, notes, and snippets.

@rkitover
Created August 7, 2024 03:36
Show Gist options
  • Save rkitover/7d3090e6cda9e8fdece25a7c693d9ef9 to your computer and use it in GitHub Desktop.
Save rkitover/7d3090e6cda9e8fdece25a7c693d9ef9 to your computer and use it in GitHub Desktop.
page weechat irc logs
irclog() {
chan_log=$(find ~/.weechat/logs -name "*.#${1}.*" -printf '%p ' | sed 's/ $//')
case "$chan_log" in
*" "*)
echo >&2 'irclog: multiple matches'
unset chan_log
return 1
;;
"")
echo >&2 'irclog: no matches'
unset chan_log
return 1
;;
esac
e=$(printf '\033')
sed -En "s/^[0-9]{4}-(.{11}).*:[0-9][0-9][[:space:]]+([^-<[:space:]][^[:space:]]+)[[:space:]]+(.*)/${e}[1;97m\\1${e}[0m ${e}[1;97m<${e}[0;38;2;140;206;250m\\2${e}[1;97m>${e}[0m \\3/p" "$chan_log" | less -r
unset chan_log e
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment