[Nottingham] saved by the shell ?

Martin martin at ml1.co.uk
Tue May 20 18:51:53 BST 2008


Martin Kirk wrote:
> Hi All,
> 
> i have a mailbox (maildir format) that, thanks to some over-zealous status 
> reporting by a firewall, has received approx. 35,000 messages in the the last 
> few days.
> 
> i have shell access to the server so was hoping i could use some command-line 
> trickery to remove all messages with a given subject line.
> 
> after a bit of googling i figure i need something along the lines of :-
> 	grep "My Subject Line" ./* | xargs rm
> but i'm getting an error "bin/grep: Argument list too long"
> 
> can anyone put me on the right track ?

Easiest is to use "find" to feed grep a file at a time.

You could be clever with xargs to feed grep a few hundred file names at
a time...


And yes, I much prefer Maildirs over mbox, especially so for the
multi-megabyte attachments that get thrown around...

Good luck,

Cheers,
Martin

-- 
----------------
Martin Lomas
martin at ml1.co.uk
----------------



More information about the Nottingham mailing list