I'm trying to delete a bunch of files in a certain directory (on Mac OS X using Terminal)
ls | grep \([1-9]\) | xargs rm
should do the trick, but it doesn't. I'm trying to delete any file with a single digit in parentheses in the filename (duplicates downloaded from the web), but it ends up doing something like this:
> rm: 520syllabus2010: No such file or
> directory rm: (3).pdf: No such file or
> directory
because it doesn't interpret the space correct. It should delete "520syllabus2010 (3).pdf"
What's the proper way of doing this?
Thanks, Jeff
#. – honk Jan 31 '11 at 20:45#. – Ignacio Vazquez-Abrams Jan 31 '11 at 20:47(3). It's best to quote arguments so that the shell doesn't affect them. – Ignacio Vazquez-Abrams Jan 31 '11 at 20:55