This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Rounding off real (floating point) values - bash to awk


Hello,

I can use a script like:

#!/bin/bash
x=3.7
# pass variable x to awk via -v (var=value)
awk -v x=$x 'BEGIN { printf "%3.0f\n", x }'
#

which returns the value 4 as expected, but are there any other methods
that can be used?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]