Replacing a pattern in a file

Hi.,

In my file I want to replace the occurance of the VARIABLE_1 with VARIABLE_2 in a particular line..

HERE is the Example:

# sed -e 's/multimediaGroup type="media" dbid=$a/multimediaGroup type="media" dbid=$b /' abc>abc.new

here I am replacing the $a with $b But it is not working..

It is not showing any error .., But the $a value remains same...

Any body Guide me how to do it...

[432 byte] By [susee_sun@yahoo.co.in] at [2007-11-26 10:32:19]
# 1

Thats because your sed expression is omitted with single-ticks ( ' ), and variables are not expanded within single ticks.

You should escape your quote chars (meaning; replace " with \"), and then change your single-ticks to quotes. For example:

sed -e "s/multimediaGroup type=\"media\" dbid=$a/multimediaGroup type=\"media\" dbid=$b /" abc>abc.new

.7/M.

mAbrante at 2007-7-7 2:40:04 > top of Java-index,Solaris Operating System,Solaris 10 Features...