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

2015-12-03 Thread Duncan Roe
On Thu, Nov 26, 2015 at 09:18:52AM -0500, Eliot Moss wrote: > On 11/26/2015 8:24 AM, Lester Anderson wrote: > >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

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

2015-11-26 Thread Lester Anderson
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:

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

2015-11-26 Thread Eliot Moss
On 11/26/2015 8:24 AM, Lester Anderson wrote: 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? In bash this

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

2015-11-26 Thread Steven Penny
On Thu, Nov 26, 2015 at 7:24 AM, Lester Anderson wrote: > x=3.7 > 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? echo 3.7 | awk '{printf "%.0f", $0}' -- Problem reports:

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

2015-11-26 Thread Steven Penny
On Thu, Nov 26, 2015 at 10:29 AM, Steven Penny wrote: > echo 3.7 | awk '{printf "%.0f", $0}' Another option awk 'BEGIN {printf "%.0f", ARGV[1]}' 3.7 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation:

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

2015-11-26 Thread Helmut Karlowski
--- > On Thu, Nov 26, 2015 at 10:29 AM, Steven Penny wrote: > > echo 3.7 | awk '{printf "%.0f", $0}' > > Another option > > awk 'BEGIN {printf "%.0f", ARGV[1]}' 3.7 #4: printf "%3.0f\n" 3.7 -Helmut -- Problem reports:

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

2015-11-26 Thread Eliot Moss
On 11/26/2015 12:20 PM, Helmut Karlowski wrote: --- On Thu, Nov 26, 2015 at 10:29 AM, Steven Penny wrote: echo 3.7 | awk '{printf "%.0f", $0}' Another option awk 'BEGIN {printf "%.0f", ARGV[1]}' 3.7 #4: printf "%3.0f\n" 3.7 Yes, while

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

2015-11-26 Thread Achim Gratz
Lester Anderson writes: […] By now, none of what you ask has anything to do with Cygwin anymore. Please consider chosing a more appropriate forum for your questions. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Waldorf MIDI Implementation &