Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i get this to leave the ownership as it was? 1

Status
Not open for further replies.

farley99

MIS
Feb 12, 2003
413
US
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?
 
ex - ${ii} <<EOF
s/name1/name2/
wq!
EOF

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Or use cp -p to preserve file atributes, e.g.....

files=`grep -r name1 * -l | grep -v convert`
for ii in $files; do
echo &quot;Processing $ii&quot;
cp -p $ii $ii.tmp
sed -e &quot;s/name1/name2/&quot; $ii >$ii.tmp;mv $ii.tmp $ii
done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top