How to replace string $str1_str2_str3_str4$ to 12.345.65.234


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to replace string $str1_str2_str3_str4$ to 12.345.65.234
# 1  
Old 02-06-2007
How to replace string $str1_str2_str3_str4$ to 12.345.65.234

Hi Friends,

I have some problem in replacing a string which is enclosed between $ signs. Please see below:
I am trying to replace the string ($str1_str2_str3_str4$) with 12.345.65.234 but no luck...
I am using the following command for this but it's not doing anything, if I take out the second "\$" sign it works perfect but still I have the second $ sign with the replaced string.

cat web.xml | sed -e "s/\$str1_str2_str3_str4\$/12.345.65.234/" > web_temp.xml

Can somebody give your thoughts how I can replace this whole string ($str1_str2_str3_str4$) with the IP address.

Thanks for your help.

Venkat
# 2  
Old 02-06-2007
use single quotes.

You should probably also consider getting rid of the UUOC.
# 3  
Old 02-06-2007
Thanks for the quick reply.

I tried the following command:

cat web.xml | sed -e 's/'$'BACK_OFFICE_URL_IP'$'/10.203.13.130/' > web_sed.xml

but it replaced the string with ip address but the $ 's still there.


Thanks for your help
# 4  
Old 02-06-2007
Try...
Code:
sed -e 's/\$BACK_OFFICE_URL_IP\$/10.203.13.130/' web.xml > web_sed.xml

# 5  
Old 02-07-2007
Thanks a lot! all.

It worked perfectly.
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

2. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies
Login or Register to Ask a Question