![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Triml leading zeros in unix | kingofprussia | UNIX for Dummies Questions & Answers | 7 | 08-07-2008 05:04 AM |
| Help needed in padding leading zeros | jakSun8 | Shell Programming and Scripting | 12 | 07-02-2008 07:41 PM |
| Removing leading zeros from a variable | toshidas2000 | Shell Programming and Scripting | 6 | 02-27-2008 01:13 PM |
| Leading zeros | wtofu | Shell Programming and Scripting | 1 | 09-16-2006 02:52 PM |
| Conversion to display leading zeros for numerics | dsimpg1 | Shell Programming and Scripting | 4 | 12-02-2005 11:43 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
how to retain leading zeros
Hi All,
I am working with a fixed width file Forrmat. C1 Number (10,3) C2 Number (10,3) e.g. c1= 0000000100.000 c2= 0000000020.000 0000000100.0000000000020.000 I have to perform c1 - c2 . i.e. I want answer to be 0000000080.000. but I am loosing the leading zeros( only getting 80.000) when I am manipulating the file using awk. I tired with printf(%10.3f,c1-c2), but i am unable to retain leading zeros in the output. Is there any way to retain leading zeros. As of now I could think of writing a logic to get the original length of c1 and then padd that many zeros to the final value of c1-c2. Any body has any other thoughts or any easy way to get this? Thanks, --Manish |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|