<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>OK, I've now used paste(1) about <i>three</i> times in my life...<br>
<br>
To re-flatten the output of egrep into a single line, as in:<br>
<br>
    egrep -e '^Date:|^From:|^Subject:' $mailfile | paste -d'|' - - -<br>
<br>
Specifically, I'm working on Maildir-style files so I don't have to
worry about "losing synchronization" if one of the headers is missing
for some reason, and the names of the files are contained in the file </tt><tt>"0006966d83811cd33a120e436a67d312"</tt>.<br>
<br>
so:<br>
<br>
<tt>    for i in $(cat 0006966d83811cd33a120e436a67d312 ); do <br>
        (echo $i|cut -d'/' -f2 ; egrep '^Date:|^From:|^Subject:' ../$i
) | paste -d'|' - - - - ; <br>
    done <br>
<br>
produces output like:<br>
<br>
    .DNS|Date: Fri, 5 Jun 2009 21:16:22 -0400 (EDT)|From: "easyDNS
Support" <a class="moz-txt-link-rfc2396E"
 href="mailto:support@easydns.com">&lt;support@easydns.com&gt;</a>|Subject:
[easyDNS] Automated 30
day renewal reminder 2009-07-05<br>
    .DNS|Date: Fri, 5 Jun 2009 21:16:22 -0400 (EDT)|From: "easyDNS
Support" <a class="moz-txt-link-rfc2396E"
 href="mailto:support@easydns.com">&lt;support@easydns.com&gt;</a>|Subject:
[easyDNS] Automated 30
day renewal reminder 2009-07-05<br>
<br>
which I can then feed into the next stage of parsing.<br>
<br>
-Adam<br>
<br>
</tt>
</body>
</html>