Cleaning quoted text from forwarded e-mails

Tags: programming

Published on
« Previous post: Better colour palettes for gnuplot — Next post: Serving git repositories the smart way »

I often receive e-mails that have been forwarded through several hops. Most of the time, the body of these messages contains multiple layers of “greater-than” sign. This complicates reading and ticks me off to no end. Luckily, Claws-Mail allows me to filter my messages using custom shell commands. I thus set up the following action:

sed -i 's/^>\(>\)*\(\s\)*//' %f 

This sed expression works in-place (hence the -i) and removes all quote levels from the beginning of each line. Obviously, this may screw up the formatting for some e-mails, so I run this action only on-demand.