I have a group of files I'd like to remove at once.
ls | egrep \^New
The output is as expected,
New 1
New 2
New 3
but continuing the pipe with
| xargs -L rm
attempts to remove the input as space-delimited:
rm: New: No such file or directory
rm: 1: No such file or directory
What am I missing?
xargs
has a-d
option. – erythraios Oct 17 '17 at 16:42xargs -d
is not POSIX. But thexargs
provided by GNU Findutils, which is present in GNU/Linux systems, does support it. – Eliah Kagan Oct 17 '17 at 16:47rm New*
or usefind . -type f -name "New*" -print0 |xargs -0 -r rm
.. both handle special char correctly (the later is recursive and it's very powerful) – Franklin Piat Oct 17 '17 at 18:26