#!/bin/sh

# 822flatten
#
# Flatten RFC 822 headers that span multiple lines

awk '
$0 ~ /^$/ { exit }

$0 !~ /^[ 	]/ {
	if (h != "")
	{
		print h
		h = ""
	}
}

{
	h = h $0
}

END {
	if (h != "")
	{
		print h
		h = ""
	}
}
' | sed 's/,  */, /g'


© 1998, Boyd Roberts: boyd@fr.inter.net