Sponsored Content
Full Discussion: how to retain leading zeros
Top Forums Shell Programming and Scripting how to retain leading zeros Post 302095725 by Manish Jha on Thursday 9th of November 2006 04:43:10 PM
Old 11-09-2006
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
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Leading zeros

How to insert leading zeros into a left-justisfied zip code? e.g. Zip code is written as 60320 which is left-justified to make it be read as 0060320. We have to move it to right-justifiable then insert 2 leading zeros into it... ;) (1 Reply)
Discussion started by: wtofu
1 Replies

2. Shell Programming and Scripting

Removing leading zeros from a variable

How do I remove or add leading zeroa from a variable. To make variable 10 characters long when adding zeros. (6 Replies)
Discussion started by: toshidas2000
6 Replies

3. Shell Programming and Scripting

Help needed in padding leading zeros

Hi all, I have file with numeric values. I need to pad each value with leading zeros such that total lenght of each value is 16. Example: cat tmp.txt 502455 50255 5026 5027 5028 Output 0000000000502455 0000000000050255 0000000000005026 0000000000005027 0000000000005028 Any... (12 Replies)
Discussion started by: jakSun8
12 Replies

4. UNIX for Dummies Questions & Answers

Triml leading zeros in unix

Hi All, How does one trim leading zero's in unix Thanks KP. (7 Replies)
Discussion started by: kingofprussia
7 Replies

5. Shell Programming and Scripting

Help with adding leading zeros to a filename

Hi i need help in adding leading zero to filenames e.g file name in my folder are 1_234sd.txt 23_234sd.txt the output i need is 001_234sd.txt 023_234sd.txt can i do this shell scripting please help (2 Replies)
Discussion started by: rsmpk
2 Replies

6. Shell Programming and Scripting

Removing leading zeros for a decimal column

removing leading zeros for a decimal column in a file which has string & decimal values ,,,,,6630140,XXXXXXXXXXXXXXX, 0020.00,USA ,,,,,6630150,XXXXXXXXXXXXXXXL (xyz, 0010.00,USA ,,,,,6630150,XXXXXXXXXXXXXXX(xyz), 1300.00,USA My file contains 9 columns. Out 9 columns, 8th column contains the... (9 Replies)
Discussion started by: marpadga18
9 Replies

7. UNIX for Dummies Questions & Answers

Add leading zeros to columns in a file

Hello Gurus, Quick question. I have a file with the following records: A~000000000000518000~SLP ~99991231~20090701~88.50~USD~CS~ A~000000000000518000~SLP ~99991231~20090701~102.00~USD~CS~ A~000000000000772000~SLP ~99991231~20100701~118.08~USD~CS~ I wold like to do the following: 1. Add... (1 Reply)
Discussion started by: chumsky
1 Replies

8. Shell Programming and Scripting

How to pad with leading zeros for current time?

I'm using cygwin bash to submit scheduled tasks (kinda like cron jobs) in windows and the following script is giving me grief. I need to format the current time with leading zeros before 10AM for the hour field. In this example, I manually typed in "09:50" instead of using the `printf...`... (2 Replies)
Discussion started by: siegfried
2 Replies

9. Shell Programming and Scripting

Numbers with leading zeros

Hi, i have a variable which conatins values like 00001,0003,00067,00459. I want to use the values one by one and in the same form as they are like 00001,0003,00067,00459. Also can anyone tell me how to increment those numbers by 1,keeping the format as same like 00002,0004,00068,00460.... (5 Replies)
Discussion started by: arijitsaha
5 Replies

10. Shell Programming and Scripting

Help deleting leading zeros in a file

I have a list of numbers extracted and need to delete the leading zeros from them, but when i do so, the command I am using also deletes numbers that end in Zero as well. eg 10, 20, 30, etc this is part of a larger script and the only way I can think of is to try and detect the 10,20 30 etc in... (19 Replies)
Discussion started by: kcpoole
19 Replies
oakdecode(1)						      General Commands Manual						      oakdecode(1)

NAME
oakdecode - Decode an OAKT printer stream into human readable form. SYNOPSIS
oakdecode [options] <OAKT-file DESCRIPTION
oakdecode decodes an OAKT printer stream into human readable form. An OAKT printer stream is the printer langauge used by the HP Color LaserJet 1500 and other printers. COMMAND LINE OPTIONS
These are the options that can appear on the command line. -d basename Basename of .pbm file for saving decompressed planes. -r basename Basename of .jbg file for saving raw planes -i Suppress display of image records. -o Print file offsets. -D level Set Debug level [0]. EXAMPLES
Decode an OAKT file created by foo2oak. $ oakdecode < testpage.oak 0d(80) 1 OTHER 0c(64) Wed Nov 05 16:30:50 2003 a07d3 100005 32001e 0a(80) testpage.pdf 14(16) (no args) 28(16) Source=Tray1 29(80) PaperType=0 UNK8=2,0,0,0, blanks(63) 2a(32) Copies=1 UNK=0 2b(32) papercode=25 xwid=4648 ywid=9000 UNK=0 33(64) u0 u1 w h resx resy nBits x0 x0 2128 4300 600 600 x1 15(16) (no args) bih0 w h l0 bih5 dlen plen unk yOff P subP 3c(64) 00010000 2176 256 256 58030020 1050 1056 000 64 3 0 DL = 0, D = 0, P = 1, - = 0, XY = 2176 x 256 L0 = 256, MX = 32, MY = 0 Order = 3 ILEAVE SMID Options = 88 LRLTWO TPDON TPBON 1 stripes, 0 layers, 1 planes 3c(64) 00010000 2176 256 256 58030020 3668 3680 000 320 3 0 3c(64) 00010000 2176 256 256 58030020 1463 1472 000 640 3 0 3c(64) 00010000 2176 256 256 58030020 1975 1984 000 896 3 0 3c(64) 00010000 2176 224 224 58030020 2744 2752 000 1152 3 0 3c(64) 00010000 2176 256 256 58030020 988 992 000 1440 3 0 3c(64) 00010000 2176 256 256 58030020 2892 2896 000 1696 3 0 3c(64) 00010000 2176 256 256 58030020 3634 3648 000 1952 3 0 3c(64) 00010000 2176 256 256 58030020 3236 3248 000 2208 3 0 3c(64) 00010000 2176 256 256 58030020 2279 2288 000 2464 3 0 3c(64) 00010000 2176 256 256 58030020 3746 3760 000 2720 3 0 3c(64) 00010000 2176 200 200 58030020 2404 2416 000 2976 3 0 3c(64) 00010000 2176 256 256 58030020 3114 3120 000 3240 3 0 3c(64) 00010000 2176 96 96 58030020 1142 1152 000 3496 3 0 3c(64) 00010000 2176 256 256 58030020 2094 2112 000 3752 3 0 3c(64) 00010000 2176 256 256 58030020 1319 1328 000 4008 3 0 3c(64) 00010000 2176 36 36 58030020 208 224 000 4264 3 0 17(16) (no args) 18(16) UNK=0 0b(16) (no args) FILES
/usr/bin/oakdecode SEE ALSO
foo2oak-wrapper(1), foo2oak(1), jbg2pbm(1) AUTHOR
Rick Richardson <rick.richardson@comcast.net> http://foo2oak.rkkda.com/
All times are GMT -4. The time now is 08:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy