Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 37
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
sed -e "$Number c\$Variable" vm.cfg > tmp

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

Rep: Reputation: 21
Put two slashes

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


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 08:47 AM
sed guru required for help with Win32 environment variables slugzero Programming 2 09-16-2009 01:04 AM
sed guru required for help with Win32 environment variables slugzero Slackware 11 09-12-2009 03:45 AM
SED;find and replace;help required gd13 Programming 3 12-21-2004 06:33 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:06 AM.

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