You have a huge number of files (50000) in a single directory. You need to automatically delete the ones which contain a specific text, i.e. “SPAM”.
You can not simply use rm combined with grep, because the argument list will be too long and you will get an error such as:
Use the following script:
#!/bin/bash for file in `find . | xargs grep -l "SPAM"` do rm -v $file done exit 0
Copy the text to a text file and execute it.