I'm trying to work out a percentage with out using bc as this isn't installed on the clients server and they won't allow it to be.
Normally I would do echo 100/$limit*$usage | bc -l
eg:
echo 100/32212254720*213779238 | bc -l
Which returns a value of .00001271565755207680
This is then rounded using printf "%.0f\n" .66365810111130947790
which returns 0
I'm trying to do this with awk.
awk "BEGIN {print (100/$limit*$usage)}"
eg:
awk "BEGIN {print (100/32212254720*4096)}"
Which returns 1.27157e-05
and when rounded using printf "%.0f\n" 1.27157e-05
also returns 0
So both do seem to be working but is awk used correctly and why does it return 1.27157e-05 and not .00001271565755207680?