[lug] Virtual Mail User - Large Mailbox Scrubbing

Ryan Fligg I foun ryan at celebrityaccess.com
Thu Jun 29 18:04:57 MDT 2006


I found a solution and it ended up being a combination of things.

I went with the double xargs command.

ls | xargs grep -li "Subject:.*delivery report" | xargs echo

then

ls | xargs grep -li "Subject:.*delivery report" | xargs rm


This is working fine and I have removed 90% of the e-mails and got the file 
down to 50MB from 5.0 GB.  

Thank you for all your fast help.

Sincerely,

Ryan R. Fligg


On Thursday 29 June 2006 17:24, Jeff Schroeder wrote:
> David:
> > > 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. :)
>
> $0.02,
> Jeff

-- 
Ryan R. Fligg
Developer

303.447.2484 fax
ryan at celebrityaccess.com
www.celebrityaccess.com
www.protouronline.com
www.boxofficenetwork.com
www.gigtrak.com

CelebrityAccess manages all tour dates for Musictoday.com,
BoxOfficeNetwork.com and ProTourOnline.com. We are the exclusive
provider for all tour dates for Viacom properties (including MTV, VH1,
CMT), as well as Billboard.

"If you want maximum exposure, don't keep your tour dates a secret--
submit them to CelebrityAccess!"



More information about the LUG mailing list