#!/usr/bin/perl -w # Takes a unix mailbox file on stdin, # spits it out on stdout, minus the # FOLDER INTERNAL DATA message my $msg = ""; my $msgnum = 0; my $skip = 0; while() { if (/^From .+/) { # Start of new message if ($msgnum == 1 and $skip == 0) { # First message was not FOLDER INTERNAL DATA, # so send it on unchanged print $msg; } $msgnum++; $skip = 0; } if ($msgnum > 1) { # Only bother looking at first message in mailbox # for FOLDER INTERNAL DATA message print; next; } else { if (/^Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA$/) { # Don't transmit this message $skip = 1; } $msg .= $_; } }