Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Description: formatlog.sh
Submitted on October 23, 2023 at 12:42 PM
Expires on October 22, 2024 at 12:42 PM (1 month from now)

New Paste 1 (Text)

#!/bin/sh

# Usage: format-irclog.sh <file>

# 1. Append two spaces to the end of each line.
# 2. Remove all characters before last `<`, e.g. `<matterbridge> <sgp> foo` becomes `<sgp> 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. `\<sgp\> foo` becomes `**\<sgp\>** foo`.

sed -E \
  -e 's/$/\ \ /' \
  -e 's/.*</</' \
  -e '/⇐/d' \
  -e '/→/d' \
  -e '/^[[:space:]]*$/d' \
  -e 's/\*/\\\*/g' \
  -e 's/_/\\_/g' \
  -e 's/</\\</g' \
  -e 's/>/\\>/g' \
  -e 's/\\<([^ ]+)\\>/\*\*\\<\1\\>\*\*/' \
  $1