[Linux-disciples] xargs -0
Stephen R Laniel
steve at laniels.org
Tue Jul 11 14:43:46 EDT 2006
How does one use xargs -0 along with commands that an
argument to go in a specific place? E.g., what do I do if I
want to copy a bunch of files into a given directory? I'd do
something like
[command] |xargs -0 cp [destDir]
but that won't work, because xargs doesn't know that destDir
is supposed to be the final argument. With 'mv', one can do
better, because it has a --target-directory option:
--target-directory=DIRECTORY
move all SOURCE arguments into DIRECTORY
So then we could do, e.g.,
grep -Zirl [pattern] [sourcePath] |xargs -0 cp --target-directory=[destPath]
But 'cp' has no such argument. In general, do we have to
rely on the kindness of other commands to output
null-separated filenames?
--
Stephen R. Laniel
steve at laniels.org
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20060711/b2dee49e/attachment.pgp
More information about the Linux-disciples
mailing list