[Mailman-Users] Revised goodheaders.awk script

Scott Courtney courtney at 4th.com
Thu Jun 13 03:10:50 CEST 2002


Good evening.

I have revised my goodheaders.awk script to take care of the Message-Id: -->
Message-ID: translation, per the note I posted to this list a couple of days
ago.

A copy of the new script is embedded in this message, for your edification.
Please feel free to use and distribute as you wish, under GPL terms. I would
appreciate a copy of any patched versions so that I can improve my version of
the source, but this is a courtesy only and is not required.

Enjoy!

***************** Begin script goodheaders.awk *****************
#!/usr/bin/awk -f
#
# Attempts to clean up some ugly header problems when importing
# mail from YahooGroups to mbox format.
#
# Author: Scott Courtney <courtney at 4th.com> http://4th.com/
#
# License: GPL (http://www.gnu.org/)
#
# Disclaimer: Written for my own one-time use; NOT thoroughly tested.
#

BEGIN {
	hdr=0;
}

/^From .*@.* .*:..:.. / {
	hdr=1;
	print $0;
}

/^$/ {
	hdr=0;
	print $0;
}

/^[A-Za-z0-9-]+: / {
	# Clean up bogus Message-Id: header and turn it into Message-ID:
	# instead. Pipermail is finicky about this.
	sub(/^Message-Id: /,"Message-ID: ");
	print $0;
}

! /^[A-Za-z0-9-]+: / && ! /^From .*@.* .*:..:.. / {
	if (hdr) {
		print " " $0;
	} else {
		print $0;
	}
}
************************* End script **************************

-- 
-----------------------+------------------------------------------------------
Scott Courtney         | "I don't mind Microsoft making money. I mind them
courtney at 4th.com       | having a bad operating system."    -- Linus Torvalds
http://www.4th.com/    | ("The Rebel Code," NY Times, 21 February 1999)






More information about the Mailman-Users mailing list