LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-30-2009, 12:49 AM   #1
shivarajM
LQ Newbie
 
Registered: Apr 2009
Posts: 22

Rep: Reputation: 15
Replacing a pattern using variable?


ip1="xxx"
ip2="bbb"

sed 's/$ip1/$ip2/g'
 
Old 04-30-2009, 01:23 AM   #2
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
s/'/"/g

i.e. use double quotes instead of single quotes.
 
  


Reply

Tags
replace, string, variables


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash search for a pattern within a string variable nutthick Programming 8 03-17-2015 07:26 PM
Replacing a bunch of lines between a pattern Namachivayam Programming 1 05-21-2007 07:23 PM
bash replacing characters within a variable baks Programming 5 03-19-2007 12:33 AM
Replacing a image filename with a regex pattern in a script jonaster Linux - General 1 09-05-2006 07:02 PM
replacing pattern with sed produces double realos Programming 1 10-17-2002 08:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration