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

Xu Wang <[email protected]> Thu, 26 May 2016 18:04:04 -0400
Newsgroups gmane.mail.procmail
Message-ID <CAJhTkNgkg7j8JJKJ7PQw=QB2WaML=ebLph47pbJ2ePH+4Yb+QA@mail.gmail.com>
On Thu, May 26, 2016 at 2:39 AM, udi M <[email protected]> wrote:
>
>
> On 25/05/16 22:41, Xu Wang wrote:
>>
>> On Wed, May 25, 2016 at 9:41 AM, LuKreme <[email protected]> wrote:
>>>
>>> On May 25, 2016, at 07:25, udi M <[email protected]> wrote:
>>>>
>>>> What I do for splitting:
>>>> 1)  cat  little.rc
>>>> :0
>>>> mydir/
>>>>
>>>> 2)  formail -s procmail  ./little.rc  < theBigBox
>>>
>>> Yep. That's what I'd do as well, but I also regard mbox as an
>>> abomination.
>>
>> Thank you to all for every response! I will spend time to test and
>> investigate.
>>
>> I wonder if the solutions that rely on regex match of "From:" are
>> robust. Is it safe to use? Or there is fear that e.g. a line in body
>> of message begins with From: it could match? I suppose I should test.
>
>
> Yes, you right,  using  awk(1), sed(1)  and so are not save for this case!!!
> See my last answer using  formail(1)  which was designed
> to do this jobs.   (This command is very simple too)

Thank you for all of your replies! Yes I would like to use formail but
I do not want to process all the emails. I still wonder if I can just
process the last without going through every single one before the
last. The tac solutions above or tail solutions are more efficient but
the formail is more safe. I wish there were something that combined
both. But perhaps I must choose between efficiency and safety.

Kind regards,

Xu