Skip to content

Instantly share code, notes, and snippets.

@aptitudepi
Last active March 13, 2024 21:24
Show Gist options
  • Save aptitudepi/a3a52fa293737aba0edc61ee6a0dc4d6 to your computer and use it in GitHub Desktop.
Save aptitudepi/a3a52fa293737aba0edc61ee6a0dc4d6 to your computer and use it in GitHub Desktop.
After downloading all emails from a folder in .eml format from ~~gmail~~ Thunderbird, format it such that every email is separated by a pipe (" | ") instead of a newline so that I can update the Gmail filter rule for new spam emails. Remember to check for false positives!
find . -type f -exec cat {} \; | nl | grep "From" | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' | sort -fu | awk '{printf "%s | ",$0} END {print ""}' | rev | cut -c 4- | rev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment