[lug] Virtual Mail User - Large Mailbox Scrubbing
lists at danielwebb.us
Thu Jun 29 16:18:05 MDT 2006
On Thu, Jun 29, 2006 at 03:39:44PM -0600, Jeff Schroeder wrote:
> Ryan asked:
> > ?I would like to start by removing all messages that have
> > ?"Undeliverable" in the subject heading.
> The quick-and-dirty grep command would be something like this:
> for file in `grep -li "^Subject:.*undeliverable"`; do rm $file; done
> I believe that will work even for long lists of files; if you attempted
> to just remove them at once using
> rm `grep -li "^Subject:.*undeliverable"`
> you may run into problems because the argument list to 'rm' will be too
> long. (Using xargs would solve that, but I actually don't know how to
> use xargs, heh.)
I tried this just to check:
for f in $(seq 1 100000); do echo -n $f; done
It worked fine, looking a bit like Moire patterns as it went by.
So why does the command line still have an argument limit?
I agree with your suggestion. I would probably move the messages into a
temporary folder before deleting them if there was any other consideration.
I always try to remember that rm is forever (that would make a good T-shirt,
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: Digital signature
More information about the LUG