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 -->
  #2 (permalink)  
Old 03-17-2008
apsprabhu apsprabhu is offline
Registered User
  
 

Join Date: Feb 2008
Location: India
Posts: 45
Hi Reddy,

The below script will work for you,

mainStr="abacus"
old_word="ab"
new_word="cd"
result=`cat $mainStr | sed "s/$old_word/$new_word/g"`

Last edited by apsprabhu; 03-17-2008 at 08:58 AM.. Reason: Missed out