Re: Extract last email from an email file (mbox format)

udi M <[email protected]> Sun, 29 May 2016 12:35:56 +0300
Newsgroups gmane.mail.procmail
Organization tau
Message-ID <[email protected]>

On 27/05/16 22:45, Xu Wang wrote:
> On Fri, May 27, 2016 at 10:09 AM, Zhiliang Hu <[email protected]> wrote:
>> On Thu, 26 May 2016, Xu Wang wrote:
>>
>>> Date: Thu, 26 May 2016 21:03:15 -0400
>>> From: Xu Wang <[email protected]>
>>> Subject: Re: Extract last email from an email file (mbox format)
>>>
>>> Hello, this is....
>>> From: will this be matched?
>>>>  From how about this one?
>>> ---------------------------------end last message
>>>
>>> So this is why I am not sure matching regex with "^From " is safe. It
>>> will also match in the body.
>>
>> As a tradition, when a mail is saved into mbox format, any leading "From"
>> line is prefixed with ">" as in your example.
> I see, so mutt must not be using mbox format then because it does not do that.
>
>> You could use 'H' or 'h' flag in your little rc file to check headers only.
> What would be the full contents of little rc in this case?
I do not know what  Zhiliang  means, but,  I am afraid that you
did not check my last suggestion:  By using formail(1) + tee(1)
you do not need any rc file !

Do only one simple command:

     formail  -s  tee oneMessageOnly < theBigBox


1.   formail  works only on the headers (was dsiged for)
2.   It will not create a big directory !
3.   It is fast.

--udi


>
> Kind regards,
>
> Xu
> ____________________________________________________________
> procmail mailing list   Procmail homepage: http://www.procmail.org/
> [email protected]
> http://mailman.rwth-aachen.de/mailman/listinfo/procmail