files=`grep -r name1 * -l | grep -v convert`
for ii in $files; do
echo "Processing $ii"
sed -e "s/name1/name2/" $ii >$ii.tmp;mv $ii.tmp $ii
done
When I run this a root it changes the ownership on any file it changes to root, how do I get it to leave the ownership as it was?
for ii in $files; do
echo "Processing $ii"
sed -e "s/name1/name2/" $ii >$ii.tmp;mv $ii.tmp $ii
done
When I run this a root it changes the ownership on any file it changes to root, how do I get it to leave the ownership as it was?