The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-29-2007
Amruta Pitkar Amruta Pitkar is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 54
How to trim the leading zeroes in a Currency field ?

How do I trim the leading zeroes, and (+,-) in the currency field ?

I have a text file.
Your bill of +00002780.96 for a/c no. 25287324 is due on 11-06.
Your bill of +00422270.48 for a/c no. 28931373 is due on 11-06.

I want the O/P file to be like.
Your bill of 2780.96 for a/c no. 25287324 is due on 11-06.
Your bill of 422270.48 for a/c no. 28931373 is due on 11-06.

One of the possible ways I cud think was to write a small function to read char by char and remove the leading zeroes. Is there any other quicker and effcient way ?

Any suggestions ?

Thanks.