Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Grepmail: Search mail archives


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:)' [email protected] ~/mail

Copyright © 1995-2006 [email protected]

 
 
  Published under the terms fo the GNU General Public License Design by Interspire