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!

Change Text in Variable 1

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332
Suppose I have a variable with stored data..

I want a script to change the data while stored in the variable... Is this possible?

Something like this...

mydata="John went to the store."
sed -e 's/store/mall/g' $mydata

echo $mydata

My output would be: John went to the mall.

Thanks for any help
je


 
Yup...
Code:
   $ mydata="John went to the store."
   $ mydata=`echo ${mydata}|sed 's/store/mall/g'`
   $ echo $mydata
   John went to the mall.
Hope this helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top