LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2009, 01:37 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 36
Help required for sed command.


I want a replacement of line at perticular line number
say Number = 5
and Variable = abc

whenever i execute the following command line 5 get replaced with $Variable but not abc.

What is wrong in below code
Code:
sed -e "$Number c\$Variable" vm.cfg > tmp

Last edited by pinga123; 11-06-2009 at 01:41 AM.
 
Old 11-06-2009, 01:45 AM   #2
indiajoe
Member
 
Registered: Jan 2009
Location: India
Distribution: Porteus atma
Posts: 84

Rep: Reputation: 21
Put two slashes

Hi
You should put two slashes to prevent escape of $
Code:
sed -e "$Number c\\$Variable" vm.cfg > tmp
Cheers
-indiajoe
 
  


Reply


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
help required with the tar command bsaheb Linux - Newbie 3 11-13-2009 09:47 AM
sed guru required for help with Win32 environment variables slugzero Programming 2 09-16-2009 02:04 AM
sed guru required for help with Win32 environment variables slugzero Slackware 11 09-12-2009 04:45 AM
SED;find and replace;help required gd13 Programming 3 12-21-2004 07:33 AM


All times are GMT -5. The time now is 01:14 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration