<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Limiting awk math output to 4 decimal places in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956716#M720213</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can use the printf function in awk.  If you are familiar with C or Perl, it works pretty much the same way.&lt;BR /&gt;&lt;BR /&gt;printf("%2.4d \n", mynum)&lt;BR /&gt;&lt;BR /&gt;would format your mynum variable to two places before the decimal and four places after the decimal.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
    <pubDate>Tue, 22 Apr 2003 18:49:24 GMT</pubDate>
    <dc:creator>John Poff</dc:creator>
    <dc:date>2003-04-22T18:49:24Z</dc:date>
    <item>
      <title>Limiting awk math output to 4 decimal places</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956714#M720211</link>
      <description>When I do math in AWK I get answers much more precise then I need.  Is there an easy way to tell AWK to round off to 4 decimal places?&lt;BR /&gt;&lt;BR /&gt;e.g. - .45678 would be .4568</description>
      <pubDate>Tue, 22 Apr 2003 18:37:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956714#M720211</guid>
      <dc:creator>Jaris Detroye</dc:creator>
      <dc:date>2003-04-22T18:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting awk math output to 4 decimal places</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956715#M720212</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# echo "0.45678"|awk '{printf "%2.4f\n",$0}'&lt;BR /&gt;&lt;BR /&gt;...thus, 'printf' will do it.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 22 Apr 2003 18:47:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956715#M720212</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-04-22T18:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting awk math output to 4 decimal places</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956716#M720213</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can use the printf function in awk.  If you are familiar with C or Perl, it works pretty much the same way.&lt;BR /&gt;&lt;BR /&gt;printf("%2.4d \n", mynum)&lt;BR /&gt;&lt;BR /&gt;would format your mynum variable to two places before the decimal and four places after the decimal.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Apr 2003 18:49:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956716#M720213</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-04-22T18:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting awk math output to 4 decimal places</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956717#M720214</link>
      <description>You could try something like:&lt;BR /&gt;&lt;BR /&gt;  rout = sprintf("%4.4f", odata);&lt;BR /&gt;&lt;BR /&gt;  I ran a quick test and get the following:&lt;BR /&gt;&lt;BR /&gt;in: .45678  out: 0.4568&lt;BR /&gt;in: .45672  out: 0.4567&lt;BR /&gt;&lt;BR /&gt;Andy&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Apr 2003 18:50:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956717#M720214</guid>
      <dc:creator>Andrew Herrmann</dc:creator>
      <dc:date>2003-04-22T18:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Limiting awk math output to 4 decimal places</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956718#M720215</link>
      <description>Hi,&lt;BR /&gt;Look at the printf&lt;BR /&gt;printf "%4.4f", 10/3&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Apr 2003 18:52:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/limiting-awk-math-output-to-4-decimal-places/m-p/2956718#M720215</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-04-22T18:52:09Z</dc:date>
    </item>
  </channel>
</rss>

