NAME
grepmail - search mailboxes for mail matching a regular expression
SYNOPSIS
grepmail [-bhvi] [-d "datespec"] <regex> [mailbox ...]
DESCRIPTION
grepmail looks for mail messages containing a pattern, and prints the resulting messages on standard out.
By default grepmail looks in both header and body for the specified pattern.
When redirected to a file, the result is another mailbox, which can, in turn, be handled by standard User Agents, such as elm, or even used as input for another instance of grepmail.
OPTIONS AND ARGUMENTS
Many of the options and arguments are analogous to those of grep.
- pattern
-
The pattern to search for in the mail message. May be any Perl regular expression, but should be quoted on the command line to protect against globbing (shell expansion).
- mailbox
-
Mailboxes must be traditional, UNIX
/bin/mail
mailbox format. The mailboxes may be zipped by gzip, in which case zcat must be installed on the system. If no mailbox is specified, takes input from stdin. - -b
-
Look only in the bodies of mail messages.
- -h
-
Look only in the headers of mail messages.
- -i
-
Make the search case-insensitive (by analogy to grep -i).
- -v
-
Invert the sense of the search, (by analogy to grep -v).
- -d
-
Date specifications must be of the form of: - a date like "today", "1st thursday in June 1992", "05/10/93", "12:30 Dec 12th 1880", "8:00pm december tenth", - OR "before", "after", or "since", followed by a date as defined above, - OR "between <date> and <date>", where <date> is defined as above.
EXAMPLES
Get all email that you mailed yesterday
grepmail -d "yesterday" . sent-mail
Get all email that you mailed before the first thursday in June 1998 that pertains to research:
grepmail -d "before 1st thursday in June 1992" research sent-mail
Get all email you received since 8/20/98 that wasn't about research or your job, ignoring case:
grepmail -i -d "since 8/20/98" -v "(research|job)" saved-mail
Get all email about mime but not about Netscape:
grepmail -b mime saved-mail | grepmail -v Netscape
AUTHOR
David Coppit, <coppit@cs.virginia.edu>
SEE ALSO
elm(1), mail(1), grep(1), perl(1), printmail(1), Mail::Internet(3) Crocker, D. H., Standard for the Format of Arpa Internet Text Messages, RFC822.