On 11/01/2013 01:54 AM, Xiao Wu DAI wrote:
>
> hi,
>
> it seems `echo ..` doesn't work in GNU xargs version 4.2.27 like below
> | xargs -t -i mv {}`echo {} |sed 's/mode/dai/g'`
'echo' is your friend. Try:
echo xargs -t -i mv {} `echo {} | sed 's/mode/dai/g'`
to see that you were executing:
xargs -t -i mv {} {}
which is NOT what you wanted. You need to use proper quoting; and since
you want to do programmatic shell actions on {}, you need your xargs to
spawn an instance of sh. Try:
xargs -t -i sh -c 'mv "$1" "$(echo "$1" | sed 's/mode/dai/g')"' sh {}
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
