<<< Date Index >>>     <<< Thread Index >>>

Re: Output matching line in message body on ~b pattern match



On Tue, Apr 15, 2008 at 03:22:26PM -0400, Ethan Mallove wrote:
> If this is not possible, is there a way to download all the
> matching messages to a local filesystem so I can grep them?

I don't think it's possible to show matching lines in mutt. However, you can
copy matching mails to a Maildir-type mailbox. Set $mbox_type to Maildir and
copy matching mails to a new mailbox.

That would be something like

    :set mbox_type=Maildir<enter>       Set mailbox-type to Maildir
    T[YOUR SEARCH PATTERN]<enter>       Tag all matching mails
    ;C=my_matching_mails<enter>         Copy them to a new Maildir-mailbox named
                                        'my_matching_mails'

That's in case you didn't remap any of the default keys.

Maildir-style mailboxes save messages in different files, so you can grep
through them.

    $ grep -Hni [YOUR SEARCH PATTERN] my_matching_mails/{cur,new,tmp}/*

Problem is the overhead of typing the search pattern twice, once for mutt and
once for grep. Maybe one could write a macro/script-combo for this purpose.
Or you could convert your mailboxes to Maildirs.

Also, you maybe want to have a look at mboxgrep. It's a tool for searching
through multiple mailboxes. It's also possible to save matching messages to a
new mailbox. I don't know if you can save to a Maildir mailbox though.

HTH,
David