pmcmicha
Technical User
- May 25, 2000
- 353
I am having a problem with variables when using sed.
For example:
VAR2=`echo ${VAR0}|/usr/bin/cut -d "_" -f2`
VAR3=`echo ${VAR1}|/usr/bin/cut -d "_" -f2`
/usr/bin/sed 's/${VAR2}/${VAR3}/g' FILE > TEMP
sed isn't liking the substitution variables I am providing. No odd characters exist in these variables and I am able to successfully execute this if I use real letters instead. I can't use real letters though since these variables will be changing from time to time and I have to modify all the files within a directory.
I also tried leaving the braces off, but this did not help and I tried a backslash in front of the dollar signs as well, but again, no effect.
Does anyone have any ideas? Thanks in advance.
For example:
VAR2=`echo ${VAR0}|/usr/bin/cut -d "_" -f2`
VAR3=`echo ${VAR1}|/usr/bin/cut -d "_" -f2`
/usr/bin/sed 's/${VAR2}/${VAR3}/g' FILE > TEMP
sed isn't liking the substitution variables I am providing. No odd characters exist in these variables and I am able to successfully execute this if I use real letters instead. I can't use real letters though since these variables will be changing from time to time and I have to modify all the files within a directory.
I also tried leaving the braces off, but this did not help and I tried a backslash in front of the dollar signs as well, but again, no effect.
Does anyone have any ideas? Thanks in advance.