Hi,
facing unusual problem, below are 2 same scripts, one is working and other is not. please help
--- THIS SCRIPT IS WORKING FINE!!!!
#! /bin/sh
phone=`grep "<phone>" data.xml | sed 's:<phone>::;s:</phone>::'`
echo "Phone Number is:"$phone
repnum=554156
cat data.xml | sed -e s/$phone/$repnum/ > newdata.xml
Input File:
data.xml:
<Name>ABCDEF</Name>
<phone>748347</phone>
Output file:
newdata.xml:
<Name>ABCDEF</Name>
<phone>554156</phone>
------THIS IS NOT ABLE TO REPLACE THE VALUE OF THE TAG "PolNumber"
#! /bin/sh
polnum=`grep "<PolNumber>" adi.xml | sed 's:<PolNumber>::;s:</PolNumber>::'`
echo "PolNumber is:"$polnum
newpol=101101
cat adi.xml | sed -e s/$polnum/$newpol/ > tmpadi.xml
Input file:
>cat adi.xml
<Policy id="Policy_1">
<PolNumber>109301793</PolNumber>
</Policy>
OutPut: is Same. File is not being updated with the new value..
Any clues?
Thanks in advance.