Ward William E PHDN wrote:
> Or this:
>
> ls -1 "*March*" | xargs rm -f
>
> hmmmm... that may not work either, but this DEFINITELY should
>
> ls -1 "*March*" | awk '{printf(" -f %s\n",$1}' | xargs rm -f
Neither of those will work, because "ls" doesn't do globbing. The shell
does. When you type:
ls *March*
"ls" gets the arguments "March1.doc How_to_March.txt Eides_of_March".
However, when you type:
ls "*March*"
"ls" gets "*March*" as an arguement. It will tell you there is no such
file.
As for your "awk", I think it's a little too much. A couple of points:
AFAICT, there is no difference between "ls" and "ls -1" in this
context. Awk will produce the same output either way. It follows that
xargs will behave the same either way. "xargs" will end up executing:
rm -f -f March1 -f March2 -f March 3
So, you've added a bunch of extra -f arguments to the command, but aside
from that, done nothing useful.
Why am I ranting this morning? All of the solutions I've seen to the
problem of "rm *March*" failing have involved "ls *March*", which will
fail for the same reason that "rm *March*" does. ;)
Use "find".
MSG
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.