dotfiles/mutt/killsig
2013-09-26 23:46:43 +02:00

22 lines
455 B
Perl
Executable file

#!/usr/bin/perl
#
# killsig: delete signature (also "oe-sigs") when quoting emails.
# known patterns: ">-- " , "> -- ", ">--", "> --".
#
# Michael Velten <michael@michnet.de>
open(MAIL, "+<$ARGV[0]") || die "$0: Can't open $ARGV[0]: $!";
while (<MAIL>) {
unless (/^>>? ?-- ?$/) {
push(@purged, $_);
}
else {
while (<MAIL>) {
push(@purged, $_) unless /^>.+/;
}
}
}
truncate(MAIL, 0);
seek(MAIL,0,0);
print MAIL @purged;
close(MAIL);