[lug] Virtual Mail User - Large Mailbox Scrubbing

Jeff Schroeder jeff at zingstudios.net
Thu Jun 29 17:24:40 MDT 2006


> > for file in `grep -li "^Subject:.*undeliverable"`; do rm $file;
> > done
> This may not be quite right.  It will find messages matching your
> pattern on any line, not just the Subject header.

I'm using the caret to indicate start-of-line, and a colon after 
"Subject", which should really cut down on false positives.  I agree 
that it's *possible* a message containing

Subject: undeliverable

anywhere in its body (so long as it's on a new line AND followed by a 
colon) will be picked up by this-- but it's unlikely that will happen.

There are Perl modules specifically intended for extracting e-mail 
headers and searching them, but the resulting command will be much more 
complicated than a one-liner. :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20060629/53b982f2/attachment.pgp>

More information about the LUG mailing list