How do I remove all files not containing a specified text.
I understand the solution to remove files with a specified text, but I need to remove files NOT containing a specified pattern.
The following command creates a list of files not containing "successful run":
grep -c "successful run" *.out | grep -v ":1" > err.txt
I wish to directly delete these files.
Comments
Post a Comment