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:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=qoRLD8sMRf3koL4IRFQAZiYv7+XbX M3P1XTqu4MTZpRtE1ha7rPjcaUyUWjCl2g4H044ZTLBdVi8h8wyU+x7SD0AySVQb 4XEX6tKT0rq7yXzHYple/F/eF1BJZjjUerFYniuCf4FzvfeqELcxy/+Ngxu78DE0 OFacCkH8Bhyk8Y= 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:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=eSK9k8fGO5+hUjVw38joWB9szMI=; b=M4d vY2jHKk7B6lgv4QeroTup6lN1FC5ur/BzRUigYV42s6Q6gvO/3J5UtQEmok9XUqx xtdWv8WslbxjUXz6Z/mWBiBb71JpkwIBfQ5mPnsNzX8tc7zxA/tCCUDy9sMx7W2+ C9Ve09n9jzMDVYh4qMElmsrjxiEi6X+QTxd1k+2I= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lf0-f43.google.com MIME-Version: 1.0 X-Received: by 10.112.129.134 with SMTP id nw6mr18003003lbb.10.1448544274071; Thu, 26 Nov 2015 05:24:34 -0800 (PST) Date: Thu, 26 Nov 2015 13:24:34 +0000 Message-ID: Subject: Rounding off real (floating point) values - bash to awk From: Lester Anderson To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes 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