delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/11/26/12:21:02

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:cc:subject:content-type
:content-transfer-encoding:in-reply-to:references:date
:message-id:mime-version; q=dns; s=default; b=hX5WjJie9xSIVfVpL+
CCpbg0tH0mgtDU+Nt7tDH7tWRNmWyBKGLENh6ho3t7wdeoc1u45FVY5U4daPjVby
c8b91PX6d33+c8udQ2H5mRJG8hIOhjE7vEFrKnZbzRlHS181ZYFQTItXQq5z1yee
zpbNrKcaf4WM7fKyFQVssZh7M=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:cc:subject:content-type
:content-transfer-encoding:in-reply-to:references:date
:message-id:mime-version; s=default; bh=S7HJtxezXTSwtw9jg4gjhHdz
ABQ=; b=heWIpbBTvl42mcpkAOgXAB2+Yi7HTWuX+7/trhoCfITnX74cR7Cz4Yl0
p21DJHL1ywaHV4aJ6s05n44umtntCd+GU6AqmWYChZKJmZ3iFJjTTzh4sLtWrbZJ
CSBZRvxZgJkalNLQnWkuam2uIafRo3mXVJ1L2Iu83XlYaYOpUQo=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mailout.ish.de
X-Abuse-ID: hremUFXL0y-8240 AT umkbw DOT customer
From: Helmut Karlowski <helmut DOT karlowski AT ish DOT de>
To: cygwin AT cygwin DOT com
Cc: cygwin AT cygwin DOT com
Subject: Re: Rounding off real (floating point) values - bash to awk
In-Reply-To: <CAAXzdLWU8LGBvnXM2Fa+TzFYAfoo0tQ0_kYQJXbJuqe930KhaQ@mail.gmail.com>
References: <CAAXzdLWK6hexdYcQM6CcvxVmE=ctyTqnYYHN_r+B6qC-8thVFw AT mail DOT gmail DOT com> <CAAXzdLWU8LGBvnXM2Fa+TzFYAfoo0tQ0_kYQJXbJuqe930KhaQ AT mail DOT gmail DOT com>
Date: Thu, 26 Nov 2015 18:20:41 +0100
Message-Id: <20151126182041.6373EEF8.helmut.karlowski@ish.de>
MIME-Version: 1.0
Outgoingd: 0.4.0_m1
X-IsSubscribed: yes

---------------------------------------------------
> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019