summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-11-09 16:02:05 +0100
committerErich Eckner <git@eckner.net>2017-11-09 16:02:05 +0100
commit0f0593b3e22f9b4f837a0bf46e214ccfe3f1a8aa (patch)
tree02afbddb52975a9c7569f809c2387b22786a42cc
downloadshow-irc-log-0f0593b3e22f9b4f837a0bf46e214ccfe3f1a8aa.tar.xz
Initial commit
-rwxr-xr-xshow-irc-log44
1 files changed, 44 insertions, 0 deletions
diff --git a/show-irc-log b/show-irc-log
new file mode 100755
index 0000000..61c7af2
--- /dev/null
+++ b/show-irc-log
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+tmp_dir=$(mktemp -d)
+trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
+
+find /mnt/archlinux32/irc-logs/#archlinux-ports/ \
+ -type f \
+ -mtime -2 \
+ -name '*-*-*.html' | \
+ sort | \
+ while read -r s; do
+ sed -n '
+ s|^.* <span class="person" style="[^"]\+">&lt;\([^&]\+\)&gt;</span>|\1 \||
+ T
+ p
+ ' "${s}"
+ done | \
+ tail -n30 > \
+ "${tmp_dir}/input"
+
+sed 's@|.*$@|@' "${tmp_dir}/input" | \
+ {
+ cols=0
+ while read -r s; do
+ if [ ${#s} -gt ${cols} ]; then
+ cols=${#s}
+ fi
+ done
+
+ sed '
+ s@\(|.\{'"$((50-cols))"'\}\)\(.\)@\1\n| \2@
+ P
+ D
+ ' "${tmp_dir}/input" | \
+ sed '
+ s/^[^|]*$/| \0/
+ :a
+ /^.\{'"$((cols-1))"'\}|/b
+ s/|/ |/
+ ba
+ '
+ } | \
+ tail -n30 | \
+ tac