Value of a variable in sed command

February 16, 2009 at 21:19:24
Specs: UNIX
In my UNIX script, I have 2 variables ${DATE} and ${TIME}. How can I use the values of those variables in a sed command?
For example, how do I code the correct syntax to do this:

sed 's/DDMMYYYYHHMMSS/${DATE}${TIME}/g' < file1.xml > file2.xml

Please someone advice. Thanks!

See More: Value of a variable in sed command

Report •

February 17, 2009 at 07:31:00
Try something like this:

sed 's/DDMMYYYYHHMMSS/'"${DATE}"''"${TIME}"'/g'

Report •

February 26, 2009 at 15:40:20
I'm sorry for the late reply but yes it did work. Thank you!

Report •

Related Solutions

Ask Question