Can anyone shed any light on this, essentially what I am trying to do is read in a column of numbers and print out the number left padded with zeroes(width of 15) and no decimal place i.e
INPUT
0.69 000000000000069
7.1 000000000000710
5 000000000000500
The below script is returning strange results. (a.awk)
{
rec_amt=69.35
d_doc_amt=sprintf("%015d", rec_amt*100)
print "rec_amt is >"rec_amt"< and d_doc_amt is >"d_doc_amt"<"
}
echo 1 | awk -f a.awk
rec_amt is >69.35< and d_doc_amt is >000000000006934<
INPUT
0.69 000000000000069
7.1 000000000000710
5 000000000000500
The below script is returning strange results. (a.awk)
{
rec_amt=69.35
d_doc_amt=sprintf("%015d", rec_amt*100)
print "rec_amt is >"rec_amt"< and d_doc_amt is >"d_doc_amt"<"
}
echo 1 | awk -f a.awk
rec_amt is >69.35< and d_doc_amt is >000000000006934<