[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Does bash have a tool ?

On Sun 04 Mar 2018 at 12:14:36 (-0600), John Hasler wrote:
> Richard Owlett writes:
> > I don't have any background in Perl and the last formal course in
> > programming was in the 60's.
> Perl is just bash, ed, sed, awk, grep, etc all smushed together into
> one.
> > However awk and/or sed may be what I'm looking for and are well
> > documented.
> It's exactly what those tools are for.  Don't forget the rest of the
> toolkit.

There's a case here for using specialist tools as we know we're
dealing with emails.

I'd start by using a client like mutt to sort out which messages to
process. The easiest way of doing this is¹ to copy the outbox, open
the copy and sort the index by Subject. (o s in mutt.)

Because Re: is normally ignored in mutt when sorting thus, type
:set reply_regexp=""
to temporarily defeat that. As a result, all the Re: messages now
sort together.

On the first Re: in the list, press and hold down the <d> key to
mark them as deleted. $ will now purge them. Quit.

Now I would run formail on the shrunken mailbox using the -s option
to run itself recursively, thus:

$ formail -s formail -I "" < path/to/shrunken-mailbox > file-of-concatenated-bodies

The first formail splits the mailbox and pipes each message to the
second one which strips the headers, pipes it back to the first which
pipes it into the output file.

¹the process may differ from client to client.


Reply to: