Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting rid of trailing zeroes

Status
Not open for further replies.

IMAUser

Technical User
May 28, 2003
121
CH
Hi ,

I have a XML data file which has numbers with trailing zeroes.
<amount>100.000000</amount>
<amount>99.0000</amount>
<amount>100.000001</amount>
<amount>7.007000</amount>
<amount>98.100000</amount>
<amount>100.000000</amount>

I can eliminate all zeroes in places like (100.000000 and 99.0000) by saying
s/\.[0]*</</g

But am not able to get rid of the trailing zeroes on 7.007000 and 98.100000

The number of zeroes is variable. I am free to use AWK as well if it can be done using AWK.

Thanks
 
sed -e 's/[0]*</</g;s/\.</</g'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top