The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search, replace string in file1 with string from (lookup table) file2? gstuart Shell Programming and Scripting 9 06-08-2009 06:11 AM
replace string sam99 Shell Programming and Scripting 4 03-04-2008 01:39 AM
replace a string melanie_pfefer Shell Programming and Scripting 11 01-17-2008 10:57 AM
Replace string B depending on occurence of string A hemangjani Shell Programming and Scripting 1 12-05-2006 05:10 PM
How to replace within a string aukequist Shell Programming and Scripting 2 02-07-2006 07:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-06-2007
venkatba venkatba is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 3
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 (permalink)  
Old 02-06-2007
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,190
use single quotes.

You should probably also consider getting rid of the UUOC.
  #3 (permalink)  
Old 02-06-2007
venkatba venkatba is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 3
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 (permalink)  
Old 02-06-2007
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,402
Try...
Code:
sed -e 's/\$BACK_OFFICE_URL_IP\$/10.203.13.130/' web.xml > web_sed.xml
  #5 (permalink)  
Old 02-07-2007
venkatba venkatba is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 3
Thanks a lot! all.

It worked perfectly.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0