The UNIX and Linux Forums
Forum Home
Linux and Unix Man Pages
Search Forums
Search Community Posts
Today's Posts
Quick Links
Man Pages
RedHat Commands
OpenSolaris Commands
Linux Commands
SunOS Commands
FreeBSD Commands
All UNIX Man Pages
All Linux Man Pages
Full Man Repository
Login or Register to Ask a Question and Join Our Community
Search Forums
Show Threads .
Show Posts
Tag Search
Advanced Search
Quick Links
Contact Us
Forum Rules
Today's Posts
FAQ
Pictures & Albums
All Albums
Miscellaneous
What is My IP
Whois
Mark Forums Read
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
08-03-2012
Scott
Administrator Emeritus
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:
Lord Spectre
Scott
View Public Profile for Scott
Find all posts by Scott
Member Badges and Information Modal
×