Thanks, Amit. I think we are getting close.
When I execute the command you suggested, all the 'rm' commands all appear as follows:
rm /var/spool/mqueue/qfl7PLPr
I thought the 'rm' command should stop after 'rm /var/spool/mqueue/qfl7PLPr
I am amazed at how much you can construct in a single command line when you really understand Unix.
Main Topics
Browse All Topics





by: amit_gPosted on 2007-08-25 at 22:28:48ID: 19770187
Run this ...
find /full/path/to/dir -name 'qf*' -exec echo grep -i 'junk@mydomain.com' {} \> /dev/null \&\& echo {} \; | sh | awk '{s=$0;sub("qf", "df", s); print "rm " $0 " " s;}'
if you see rm commands with 2 filenames in each command. Verify that thos are the files that you want to delete. If so Run the above mentioned command and pipe the result to sh i.e.
find /full/path/to/dir -name 'qf*' -exec echo grep -i 'junk@mydomain.com' {} \> /dev/null \&\& echo {} \; | sh | awk '{s=$0;sub("qf", "df", s); print "rm " $0 " " s;}' | sh