J
Jason Williams
Hi all, somewhat new to perl and unix scripting, here.
I am trying to run a unix ksh script to exec a perl command on each
file in a dir. Problem is, I need to include a dollar sign literal in
the right side of a substitution, like so:
-------------------------------
#!/bin/ksh
PATH=$PATH:/dbmgtu01/app/oracle/orbitz/1.0.0/bin:.
for FILE in dc0003*
do
echo $FILE
cp $FILE $FILE.bk
perl -pi -e "s/(.*)dc0003\.maintain\.partitions(.*dev.*)/
\1$calling_program_dev\2/g" $FILE
done
------------------------------
Only this does not work, because perl wants to replace the
$calling_program_dev with a ksh variable.
Here's some sample input and output:
input:
$calling_program_dir/dc0003.maintain.partitions_test -i dev_do9d
actual output:
$calling_program_dir/ -i dev_do9d
_desired output_ :
$calling_program_dir/$calling_program_dev -i dev_do9d
Any help appreciated. I've tried all sorts of things, including to
escape the dollar sign, enclose it in single quotes, etc, to no avail.
Many thanks,
Jason
I am trying to run a unix ksh script to exec a perl command on each
file in a dir. Problem is, I need to include a dollar sign literal in
the right side of a substitution, like so:
-------------------------------
#!/bin/ksh
PATH=$PATH:/dbmgtu01/app/oracle/orbitz/1.0.0/bin:.
for FILE in dc0003*
do
echo $FILE
cp $FILE $FILE.bk
perl -pi -e "s/(.*)dc0003\.maintain\.partitions(.*dev.*)/
\1$calling_program_dev\2/g" $FILE
done
------------------------------
Only this does not work, because perl wants to replace the
$calling_program_dev with a ksh variable.
Here's some sample input and output:
input:
$calling_program_dir/dc0003.maintain.partitions_test -i dev_do9d
actual output:
$calling_program_dir/ -i dev_do9d
_desired output_ :
$calling_program_dir/$calling_program_dev -i dev_do9d
Any help appreciated. I've tried all sorts of things, including to
escape the dollar sign, enclose it in single quotes, etc, to no avail.
Many thanks,
Jason