Originally Posted by i92guboj
There are lots of ways of doing it, however this way has the problem of efficiency. As I said before, you will be running one mv or cp command for each file, which is far from efficient. It all depends on the number of files of course. xargs solves that.
Besides that, what's the point of egrep? The find -iname option does the same, doesn't it? No need for an extra pipe which bogs the system resources even more and creates yet more i/o.
It's a matter of correctly passing and quoting everything. This solution is not special in that regard.
I offered it because the original thread got bogged down in trying to explain how "find" and "xargs" work together (for a relative newbie). "xargs" in particular is rather tricky in this regard.
The method I posted is easier to understand, and it's more appropriate to placing in a script than is the "xargs" approach.