LinuxQuestions.org
Have you listened to LQ Radio?
Go Back   LinuxQuestions.org > Forums > Linux > 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

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 04-30-2009, 01:49 AM   #1
shivarajM
LQ Newbie
 
Registered: Apr 2009
Posts: 22
Thanked: 0
Replacing a pattern using variable?


[Log in to get rid of this advertisement]
ip1="xxx"
ip2="bbb"

sed 's/$ip1/$ip2/g'
shivarajM is offline  
Tag This Post , ,
Reply With Quote
Old 04-30-2009, 02:23 AM   #2
Admiral Beotch
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 670
Blog Entries: 3
Thanked: 104
s/'/"/g

i.e. use double quotes instead of single quotes.
Admiral Beotch is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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 4 07-06-2008 11:32 PM
Replacing a bunch of lines between a pattern Namachivayam Programming 1 05-21-2007 08:23 PM
bash replacing characters within a variable baks Programming 5 03-19-2007 01:33 AM
Replacing a image filename with a regex pattern in a script jonaster Linux - General 1 09-05-2006 08:02 PM
replacing pattern with sed produces double realos Programming 1 10-17-2002 09:03 PM


All times are GMT -5. The time now is 09:38 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration