string replacement doesn't work with a variable
Marcel Fritzenwallner
linux at fritzenwallner.org
Thu Feb 9 13:57:50 UTC 2006
Hi,
I want to replace a string in a file, the problem is that the replacement is a
variable, and this doesn't work. I could not get it working with sed nor with perl.
Can anyone help me?
-----------------------------------------
perl -pi'.bak' -e 's/ABC/$VAR/g' file.txt
-----------------------------------------
sed 's/ABC/$VAR/' file.txt
-----------------------------------------
It just replaces the string "ABC" with the string "$VAR" instead of replacing
with the variable $VAR!
Thanks a lot for your help!
Marcel
More information about the redhat-list
mailing list