I have a xml which has several numbers, something like this:
<xml>
<case1>
<amount>3.140000</amount>
<amount2>3.0000</amount2>
<detail>
<name>something</name>
<earning>3.1000</earning>
</detail>
</case1>
<case2>
<amount>3.10000</amount>
</case2>
The xml is in a single line, and I’m testing with a regex like this:
echo "433.000" | sed -e 's/\([0-9]*\.\)\([1-9]*\)\(0*\)/\1\2/g'
But it gives me something like 3. for 3.00. I’m not trying to parse anything, just remove the zeroes. And somehow, it doesn’t do anything when I try with:
sed -e 's/\([0-9]*\.\)\([1-9]*\)\(0*\)/\1\2/g' xmlFile.xml
I have to mention that I’m not good with regular expressions, and I’m on a hosted server, so I can’t install any library or program, so only shell is allowed.
Thanks.
The following should work:
This will result in the following: