I am working with a 3 way join that is giving me a cartesian result that I do not want. :-( There are two unique IDs in A and B. C provides the translation from ID to NAME. The TIME is stored in both A and B.
This query:
select C.NAME,
A.TIME,
A.DATA1, A.DATA2, A.DATA3...
Hey Everyone,
Thanks for your help.
It turns out that the answer is a combination of things I learned here and elsewhere.
To print any number padded with zeros just place a 0 as the first character in the format specifier.
For an integer: %03d
For a real: %03.1f
awk 'BEGIN{v_nmbr=1...
I auppose if might be poor forum to answer my own question but I just figured out the answer for integers.
printf( "%.3d\n", v_nmbr ) will yield 001
I suppose that the question still remains on doing this with reals.
i.e what if v_nmbr=1.1?
How can I get awk to print out the leading zeros when padding a field width?
The command:
awk '
BEGIN{
v_nmbr=1
printf( "%3d\n", v_nmbr )
}
'
outputs 1.
I would like to get 001.
We hope that this helps.
Regards,
NPI
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.