Quote:
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:
Code:
ls -1 | while read fn
do
if grep -q postmaster "$fn"
then
echo "would delete $fn"
# rm $fn
fi
done
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.