Grepmail

The grepmail command is a grep-like tool that looks for a string or regular expression in a Unix-style mailbox and outputs the entire mail or mails that contain the pattern. If you redirect the output to a new file, that file will be a mailbox consisting of exactly the mails you were looking for, which you can open in your mail client.

Here is a simple example:

[email protected]:/home/user/Mail > grepmail Linuxbier inbox From [email protected] Tue Aug 10 09:14:34 2007 Return-path: <[email protected]> Envelope-to: [email protected] Delivery-date: Tue, 10 Aug 2004 09:14:34 +0100

Received: from person by somedomain.com with local (Exim 3.35 #1 (Debian)) id 1BuRmE-0007tX-00

for <[email protected]>; Tue, 10 Aug 2007 09:14:34 +0100 Date: Tue, 10 Aug 2004 09:14:34 +0100 To: [email protected] Subject: Mail with special word included Message-ID: <[email protected]> Mime-Version: 1.0

Content-Type: text/plain; charset=us-ascii

Content-Disposition: inline User-Agent: Mutt/1.3.28i

From: Roger Whittaker <[email protected]> Status: RO Content-Length: 106 Lines: 5

This mail includes the word "Linuxbierwanderung". It also contains some other words.

Roger Whittaker

You see the entire mail (or mails) with full headers from the inbox file that matches the expression given. The grepmail command has options that also enable you to add date and size specifications to the search.

The grepmail package is not installed by default, but is included in the openSUSE media. More information about grepmail can be found at http://grepmail .sourceforge.net/.

Was this article helpful?

0 0

Post a comment