[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: format and output all received: lines in an e-mail message
From: |
Ralph Corderoy |
Subject: |
Re: format and output all received: lines in an e-mail message |
Date: |
Wed, 20 Nov 2019 13:57:53 +0000 |
Hi Greg,
> That's all I've time for at the moment, but others may chip in and this
> saves them covering some of the ground.
Ken's mhl(1) suggestion is what I would have tried. But there's also
non-nmh solutions, e.g. sed or awk if you're familiar with those.
This prints all the Foo fields, each on a line, joining continuation lines.
#! /usr/bin/gawk -bf
BEGIN {
IGNORECASE = 1
}
pending {
if (/^[ \t]/) {
printf " %s", $0
} else {
print ""
pending = 0
}
}
/^foo[ \t]*:/ {
printf "%s:%s", FILENAME, $0
pending = 1
next
}
/^$/ {
nextfile
}
END {
if (pending)
print ""
}
--
Cheers, Ralph.