Sponsored Content
Full Discussion: Approximate a % value
Top Forums Shell Programming and Scripting Approximate a % value Post 302681227 by Scott on Friday 3rd of August 2012 03:07:38 AM
Old 08-03-2012
Change your print to be printf.

i.e.

Code:
$ echo 99.1459 | awk '{printf "%.3f\n", $1}'
99.146

(although that will also give you 100.000, so if not printf, you may need to use a function to trim the output instead)
This User Gave Thanks to Scott For This Post:
 
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy