I am trying to replace the value of a xml tag with a new one. But, the existing value in the xml contain leading spaces and I tried to remove that with different sed commands but all in vain.
For replacing the value I wrote the command in BOLD letters below:
bash-3.00$ polnum=`grep "<PolNumber>" adi99.xml | sed 's:<PolNumber>::;s:</PolNumber>::' | sed 's/^ *\(.*\) *$/\1/'`
bash-3.00$ echo "PolNumber is:"$polnum
PolNumber is: 109301793
newpol=101101
bash-3.00$ echo "cat adi99.xml | sed -e 's/${polnum}/${newpol}/'"
cat adi99.xml | sed -e 's/"THERE ARE SPACES WHICH ARE GETTING REMOVED HERE ONCE I SAVE IT HERE" 109301793/101101/'