I’m trying to pull some text from a file using “grep”, which is then saved as a variable. The variable is called, and the entire search string is translated fine, but the string itself contains other variables that are being treated as text, and not as variables. A simple example is below. Thoughts anyone? Thanks…
*********************************************
$cat 1.dat
@@001@@ STEP02
@@001@@ IF (STEP01 eq 0)
@@001@@ RUN TAKE SNODE
@@001@@ SYSOPTS=”mv $file1 $file2″
@@001@@ EIF
*********************************************
$cat test.sh
#!/bin/ksh
file1=test1.txt
file2=test2.txt
the_string=`grep “@@001@@” 1.dat | sed s/@@001@@//`
echo “$the_string”
*********************************************
$test.sh
STEP02
IF (STEP01 eq 0)
RUN TAKE SNODE
SYSOPTS=”mv $file1 $file2″
EIF