I have a database
name I want to replace inside of an xml file. I can do this in several step
using sed, but I would like to do it in a single step using perl. This is what I
have in sed and what does not work in perl.
SED
#!/bin/bash
echo -n "Please
enter the name of the new database: "
read syelledb
dbchange=`cat /tmp/data-sources.xml|grep database|cut -d ">" -f2|cut -d "<" -f1`
read syelledb
dbchange=`cat /tmp/data-sources.xml|grep database|cut -d ">" -f2|cut -d "<" -f1`
sed
s/$dbchange/$syelledb/ /tmp/data-sources.xml >
/tmp/data-sources.xml.tmp
mv /tmp/data-sources.xml /tmp/data-sources.xml.orig
mv /tmp/data-sources.xml.tmp /tmp/data-sources.xml
mv /tmp/data-sources.xml /tmp/data-sources.xml.orig
mv /tmp/data-sources.xml.tmp /tmp/data-sources.xml
PERL (single line in
bash script)
#!/bin/bash
echo -n "Please
enter the name of the new database: "
read syelledb
read syelledb
dbchange=`cat
/tmp/data-sources.xml|grep database|cut -d ">" -f2|cut -d "<"
-f1`
/usr/bin/perl -pi -w
-e 's/$dbchange/$syelledb/'
I am not using all
perl as I can only do a very limited amount in that. (just started
learning)
Tony Heal
Pace Systems Group, Inc.
800-624-5999
[EMAIL PROTECTED]