searching across folders using mutt

Ofer Inbar cos at aaaaa.org
Mon May 30 13:30:27 UTC 2022


On Sun, May 29, 2022 at 11:31:51PM -0500,
Greg Marks <gtmarks at gmail.com> wrote:
> According to the man page for notmuch:
> 
>    Mail storage that uses mbox format, (where one mbox file
>    contains many messages), will not work with notmuch.  If
>    that's how your mail is currently stored, it is recommended
>    you first convert it to maildir format with a utility such 
>    as mb2md before running notmuch setup .
> 
> Is there a solution for searching across folders for those of us whose
> e-mail is stored in mbox rather than maildir format?

You could just use the filesystem and simple shell commands.
It's not indexed, but grep is pretty fast.

For example, which "folders" (aka files, in mbox format) contain
messages with the subject line "some subject"?

$ fgrep -l 'Subject: some subject' *

Use grep -E or egrep for full regex search.
Use "find . -type f | xargs grep ..." to search files in a directory tree.

You may get some false positives when searching for a header if the
body of an email contains a header line that matches, but overall this
works well - it's what I do on the host where I have mbox format email.
  -- Cos


More information about the Mutt-users mailing list