[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: string replacement doesn't work with a variable



sed 's/ABC/'$VAR'/' file.txt


-----Original Message-----
From:	redhat-list-bounces redhat com on behalf of Marcel Fritzenwallner
Sent:	Thu 02/09/2006 08:57 AM
To:	redhat-list redhat com
Cc:	
Subject:	string replacement doesn't work with a variable

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


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request redhat com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]