Discussion:
keyword search of old messages
(too old to reply)
bob prohaska
2022-10-31 21:35:50 UTC
Permalink
I admit this is a dumb question, but couldn't find
an answer that I recognized in the help list or manpage.

How does one search through accumulated mutt mail for
messages containing a particular word in the message body?

For example, I think there's an old message containing the
word foo, but it's not in the title or subject. Is it possible
to do a full-text search of all messages in a folder?

Thanks, and apologies if I'm missing something obvious.

bob prohaska
Rich
2022-10-31 22:13:01 UTC
Permalink
Post by bob prohaska
How does one search through accumulated mutt mail for
messages containing a particular word in the message body?
The mutt manual.txt lists the ~A modifer as "all messages":

Table 4.4. Pattern modifiers
Pattern modifier Description
~A all messages

for searching from within mutt.
Post by bob prohaska
For example, I think there's an old message containing the
word foo, but it's not in the title or subject. Is it possible
to do a full-text search of all messages in a folder?
Folders are simply text files (or directories containing text files,
each file containing one message) so they are also searchable using the
standard Unix tools (i.e., grep) with help from find and xargs for the
maildir format (one file per message). The only items that would get
missed using the standard Unix tools would be odd mailers that base64
encode their entire message, even when not necessary.
Roger Bell_West
2022-10-31 22:58:14 UTC
Permalink
Post by bob prohaska
Is it possible
to do a full-text search of all messages in a folder?
Within what mutt recognises as a mailbox, ~b [regex] .

Personally I also use mairix to index all folders, but that's a
slightly different problem.
bob prohaska
2022-11-01 00:09:31 UTC
Permalink
Post by Roger Bell_West
Post by bob prohaska
Is it possible
to do a full-text search of all messages in a folder?
Within what mutt recognises as a mailbox, ~b [regex] .
That seems to do the trick. Took me a while to recognize
the tilda as the escape key 8-\

Thanks for your help!

bob prohaska
Eike Rathke
2022-11-02 09:32:27 UTC
Permalink
Post by bob prohaska
Post by Roger Bell_West
Within what mutt recognises as a mailbox, ~b [regex] .
That seems to do the trick. Took me a while to recognize
the tilda as the escape key 8-\
It's not. ~b is the pattern operator for
~b EXPR messages which contain EXPR in the message body.
man muttrc

You can use that in any expression and operation that understands
patterns, limit filters, hooks, ...

<Esc>b is a macro key binding of
M <search>~b
search in message bodies. See mutt help with ? when in index.

Eike
--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/
Peter Pearson
2022-11-01 15:21:00 UTC
Permalink
On Mon, 31 Oct 2022 21:35:50 -0000 (UTC), bob prohaska wrote:
[snip]
Post by bob prohaska
How does one search through accumulated mutt mail for
messages containing a particular word in the message body?
I've been happy with notmuch. It maintains a database that
speeds up searching over all your old emails, and allows
slightly complicated requests like requiring X in the email
body and Y on the subject line and Z in the recipient list.
In the configuration that I think is the default, the F8 key
in the mutt index display switches to a notmuch search.

On my system, the notmuch database occupies 1.2 gigabytes of storage,
and is updated daily by a cron job. The update takes well under a
minute. My maildir directory contains about 8 gigabytes of mail.
--
To email me, substitute nowhere->runbox, invalid->com.
Loading...