[Linux-disciples] xargs -0
Adam Rosi-Kessel
adam at rosi-kessel.org
Tue Jul 11 14:54:42 EDT 2006
Stephen R Laniel wrote:
>> Isn't what you want
>> grep -Zirl [pattern] [sourcePath] | xargs -i cp "{}" [destPath]
>> ??
>> (this won't necessarily deal with all escaping issues, but I think that's a
>> different topic than your question)
> No, I definitely know about the -i option, but the advantage
> of -0 is that I don't need to worry about escaping (except
> for the very unlikely case when there's a \0 in the
> filename). It seems like I ought to be using xargs -0 all
> the time, and I'd like to figure out how to do that.
Oh, well, you could just use both...?
grep -Zirl [pattern] [sourcePath] |
tr "\n" "\0" |
xargs -0i cp "{}" [destPath]
More information about the Linux-disciples
mailing list