Originally Posted by Zeno McDohl
/var/spool/clientmqueue# grep -l postmaster * | xargs rm
-bash: /usr/bin/grep: Argument list too long
Don't use these one-liners, ever. I keep telling people they are trouble, but no one seems to listen. And don't use "xargs", same reason. Do it this way:
ls -1 | while read fn
if grep -q postmaster "$fn"
echo "would delete $fn"
# rm $fn
This script has the advantage that it won't strangle on a long list (because "ls" runs without an argument) and what it does is very easy to understand.
Once you have run the script and are satisfied that it won't delete anything you want to keep, un-comment the commented line.