The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 04-22-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
sed "s#<doc_root></doc_root>#<doc_root>/$i/web</doc_root>#g" $my_file > /tmp/myTemp && mv /tmp/myTemp $my_file

OR

Code:
{ rm $my_file; sed "s#<doc_root></doc_root>#<doc_root>/$i/web</doc_root>#g" > $my_file; } < $my_file


Last edited by vgersh99; 04-22-2009 at 12:45 PM.. Reason: alternative