dotfiles/mutt/killsig

23 lines
455 B
Text
Raw Normal View History

2013-07-31 14:03:11 +00:00
#!/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>) {
2013-09-26 21:46:43 +00:00
unless (/^>>? ?-- ?$/) {
2013-07-31 14:03:11 +00:00
push(@purged, $_);
}
else {
while (<MAIL>) {
push(@purged, $_) unless /^>.+/;
}
}
}
truncate(MAIL, 0);
seek(MAIL,0,0);
print MAIL @purged;
close(MAIL);