#!/usr/bin/sed -f # # killmsgid - strip Message-ID: headers off mail messages # by Robert R Schneck # # Usage: takes a mail message on standard input, output the message # on standard output, only with any Message-ID: headers removed. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Use the buffer for state, start at 0 x /^$/ bbefore /1/ bfolding /2/ { x bprintme } :before x # done with headers /^$/ { x s/^$/2/ x bprintme } # message-id header /^message-id[ \t]*:/I bkillheader # other header bprintme :killheader x s/^$/1/ x d :folding x # continuation line after message-id /^[ \t]/ d # done with continuation lines # go back to see if there are more headers to kill x s/1// bbefore :printme