Reputation: 30
I'm working with one file.sh, but I didn't understood what does two percent symbols means %0.2f%
.
The command read a value in tmp.err and print it, just this, look below:
awk '{ printf("*** Error: %0.2f%\n",substr($2, 2, length($2) - 2) * 100) }' tmp.err
The file tmp.err have this two values separated by white space 11736 (0.17908)
.
I already know %0.2f
means a float value with two decimals.
someone know what does %0.2f%
do? or is a typo?
I'm asking this question, because right now I'm receiving an error, not enough arguments passed to printf( bu if I remove the last percentage like this %0.2f
works fine.
thanks
Upvotes: 0
Views: 2440
Reputation: 531075
The fact that the argument is multiplied by 100 leads me to think that whoever wrote that intended for a literal percent sign, which needs to be doubled.
awk '{ printf("*** Error: %0.2f%%\n",substr($2, 2, length($2) - 2) * 100) }' tmp.err
Upvotes: 2