blob: 9c709ff9ddf5af766262ca52d9a538edd2b5a413 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/bash
tmp_dir=$(mktemp -d)
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
if ! mountpoint -q /mnt/archlinux32; then
sleep $(($RANDOM%20))
if ! mountpoint -q /mnt/archlinux32; then
mount /mnt/archlinux32 || \
exit
fi
fi
find /mnt/archlinux32/irc-logs/#archlinux32/ \
-type f \
-mtime -3 \
-name '*-*-*.html' | \
sort | \
while read -r s; do
sed -n '
s|^.* <span class="person" style="[^"]\+"><\([^&]\+\)></span>|\1 \||
t ok
s|^.* <span class="person" style="[^"]\+">\* \(\S\+\) \(.*\)</span>.*$|\1 : \2|
t ok
T
:ok
p
' "${s}"
done | \
tail -n30 > \
"${tmp_dir}/input"
sed -n '
s@[|:].*$@|@
T
p
' "${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 \3@
P
D
' "${tmp_dir}/input" | \
sed '
s/^[^|:]*$/| \0/
:a
/^ \{'"$((cols-1))"'\}[|:]/b
/^\S[^|]\{'"$((cols-2))"'\}[|:]/b
s/[|:]/ \0/
ba
'
} | \
tail -n30 | \
tac
|