LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help required for sed command. (https://www.linuxquestions.org/questions/linux-newbie-8/help-required-for-sed-command-767232/)

pinga123 11-06-2009 12:37 AM

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

indiajoe 11-06-2009 12:45 AM

Put two slashes
 
Hi
You should put two slashes to prevent escape of $
Code:

sed -e "$Number c\\$Variable" vm.cfg > tmp
Cheers
-indiajoe


All times are GMT -5. The time now is 02:13 AM.