How can I delete all files containing
-20 in the filename in the current directory?
ls | grep "-20" | rm -rf
But that does not work. Ideas?
The -- stops -20 being treated as an argument to rm if the file -20 exists.
Your problem with
is that you're piping filenames to
But really, you don't want to use
But of course as the other poster said, the best solution is to