mboxgrep is a small utility that scans a mailbox for messages matching a
basic, extended, or Perl-compatible regular expression. Selected
messages can be either displayed on standard output, counted, piped to a
command or written to another mailbox.
It supports mbox (both plain and compressed), MH, nnmh, nnml and maildir
folders.