public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Rounding off real (floating point) values - bash to awk
@ 2015-11-26 13:30 Lester Anderson
  2015-11-26 15:32 ` Eliot Moss
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Lester Anderson @ 2015-11-26 13:30 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-03  9:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-26 13:30 Rounding off real (floating point) values - bash to awk Lester Anderson
2015-11-26 15:32 ` Eliot Moss
2015-12-03  9:14   ` Duncan Roe
2015-11-26 16:33 ` Steven Penny
2015-11-26 17:20   ` Steven Penny
2015-11-26 17:27     ` Helmut Karlowski
2015-11-26 18:04 ` Achim Gratz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).