xK/kike-extract-messages.sh

16 lines
345 B
Bash
Raw Normal View History

#!/bin/sh
LC_ALL=C exec awk '
BEGIN {
print "$quote \"";
print "$set 1";
}
/^\tIRC_(ERR|RPL)_[A-Z]+ *= *[0-9]+,?$/ {
match($3, /^[0-9]+/);
id[$1] = substr($3, RSTART, RLENGTH);
}
/^\t\[IRC_(ERR|RPL)_[A-Z]+\] *= *".*",?$/ {
z = substr($1, 2, length($1) - 2);
match($0, /".*"/);
print id[z] " " substr($0, RSTART, RLENGTH);
}'