This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Rounding off real (floating point) values - bash to awk
- From: Helmut Karlowski <helmut dot karlowski at ish dot de>
- To: cygwin at cygwin dot com
- Cc: cygwin at cygwin dot com
- Date: Thu, 26 Nov 2015 18:20:41 +0100
- Subject: Re: Rounding off real (floating point) values - bash to awk
- Authentication-results: sourceware.org; auth=none
- Outgoingd: 0.4.0_m1
- References: <CAAXzdLWK6hexdYcQM6CcvxVmE=ctyTqnYYHN_r+B6qC-8thVFw at mail dot gmail dot com> <CAAXzdLWU8LGBvnXM2Fa+TzFYAfoo0tQ0_kYQJXbJuqe930KhaQ at mail dot gmail dot com>
---------------------------------------------------
> 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: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple