Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Grepmail: Search mail archives

REVIEW Grepmail searches mailboxes to build a new mailbox with all emails containing the results, so that they can be reviewed with your favourite mail tool. The default is to search for the pattern in both the head and body of the email. Only email headers are searched if you specify -h; search is restricted to email bodies with -b. To be case insensitive use -i and to ignore MIME-encoded blocks use -M. Date searches are effected with -d which allows a date string in a variety of formats, including -d yesterday, -d "5/18/2001" for email since 18 May 2001.

The basic use is:

  $ grepmail <string> [<mbox>] > <newmbox>

So, for example, you might search for the email containing that meeting:

  $ grepmail -RMi "that meeting" ~/mail > meeting.mbox

This takes about 10 minutes to search my 2GB of mail files.

But perhaps you want just a report of files in which the email appears:

  $ grepmail -RMir "that meeting"

More complex patterns are possible:

  $ grepmail -RMih "^From.*Freddy" ~/mail

And to search specific headers:

  $ grepmail -RMiY '(^TO:|^From:)' freddy@ktware.de ~/mail


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.