#!/bin/sh # Usage: format-irclog.sh # 1. Append two spaces to the end of each line. # 2. Remove all characters before last `<`, e.g. ` foo` becomes ` foo`. # 3. Remove lines containing `⇐` (parts). # 4. Remove lines containing `→` (joins). # 5. Remove lines containing only whitespace. # 6. Escape the `*` character, e.g. `*foo*` becomes `\*foo\*`. # 7. Escape the `<` character, e.g. `<3` becomes `\<3`. # 8. Escape the `>` character, e.g. `1 > 0` becomes `1 \> 0`. # 9. Embolden nick, e.g. `\ foo` becomes `**\** foo`. sed -E \ -e 's/$/\ \ /' \ -e 's/.*/\\>/g' \ -e 's/\\<([^ ]+)\\>/\*\*\\<\1\\>\*\*/' \ $1