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

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



On Thu, Jul/17/2008 11:09:32PM, Ethan Mallove wrote:
> On Wed, Apr/16/2008 12:04:11PM, Ethan Mallove wrote:
> > On Tue, Apr/15/2008 11:21:29PM, David Obwaller wrote:
> > > 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
> > 
> > 
> > This worked wonders. Thanks much!
> 
> I've encountered a "this *used* to work" scenario. I'm now getting the
> below error on the ;C=my_matching_mails command:
> 
>   my_matching_mails/ is not a mailbox
> 
> Does the directory need to have certain properties?

The answer to this was that the directory could not already
be in existence. If foo/ already exists, MUTT errors with
"foo is not a mailbox". If I provide a directory that does
not yet exist, MUTT creates the directory and saves the mail
messages to it.

-Ethan

> 
> -Ethan
> 
> > 
> > -Ethan