From: Andrew Lorimer Date: Thu, 27 Dec 2018 11:37:37 +0000 (+1100) Subject: add postfix cleaner for charles X-Git-Url: https://git.lorimer.id.au/scripts.git/diff_plain/072b6fa56d0a6759bab5f665ef36ed6afc5c9d8b add postfix cleaner for charles --- diff --git a/postfix-delete.pl b/postfix-delete.pl new file mode 100755 index 0000000..ab75701 --- /dev/null +++ b/postfix-delete.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +$REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!"; + +@data = qx; +for (@data) { + if (/^(\w+)(\*|\!)?\s/) { + $queue_id = $1; + } + if($queue_id) { + if (/$REGEXP/i) { + $Q{$queue_id} = 1; + $queue_id = ""; + } + } +} + +#open(POSTSUPER,"|cat") || die "couldn't open postsuper" ; +open(POSTSUPER,"|postsuper -d -") || die "couldn't open postsuper" ; + +foreach (keys %Q) { + print POSTSUPER "$_\n"; +}; +close(POSTSUPER);