<?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: comparing floating point with borne shell in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060001#M94083</link>
    <description>echo '88.11' | sed -e 's/\.[0-9]*$//'</description>
    <pubDate>Wed, 25 Jul 2007 23:21:38 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2007-07-25T23:21:38Z</dc:date>
    <item>
      <title>comparing floating point with borne shell</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5059999#M94081</link>
      <description>&lt;!--!*#--&gt;I have a script that awk the cpu percentage from a captured top screen. &lt;BR /&gt;&lt;BR /&gt;pcent=`egrep "noc" |awk '{print $10}'1&lt;BR /&gt;&lt;BR /&gt;Then I compare pcent with 90 because if the process is greater than 90 I want to kill the process.&lt;BR /&gt;hival=90&lt;BR /&gt;if [ $pcent -gt $hival ]&lt;BR /&gt;  then&lt;BR /&gt;    (here is where I kill the process)&lt;BR /&gt;&lt;BR /&gt;I guess when pcent have a value of 88.11 it does not test correctly. Any way to convert 88.11 to a whole value instead of a decimal point value.</description>
      <pubDate>Wed, 25 Jul 2007 23:01:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5059999#M94081</guid>
      <dc:creator>Clarence Rebolledo</dc:creator>
      <dc:date>2007-07-25T23:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: comparing floating point with borne shell</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060000#M94082</link>
      <description>&amp;gt;comparing floating point with borne shell&lt;BR /&gt;&lt;BR /&gt;These are not the droids you want.  :-)&lt;BR /&gt;There is no such thing as borne shell, only ksh and posix shell.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Any way to convert 88.11 to a whole value instead of a decimal point value.&lt;BR /&gt;&lt;BR /&gt;Just use awk's printf with integer format:&lt;BR /&gt;awk '{printf "%d\n", $10}'&lt;BR /&gt;&lt;BR /&gt;Adding +.5 if you want to round up.</description>
      <pubDate>Wed, 25 Jul 2007 23:18:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060000#M94082</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-25T23:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: comparing floating point with borne shell</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060001#M94083</link>
      <description>echo '88.11' | sed -e 's/\.[0-9]*$//'</description>
      <pubDate>Wed, 25 Jul 2007 23:21:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060001#M94083</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-07-25T23:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: comparing floating point with borne shell</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060002#M94084</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;since you already have awk in use, let the work be done here. This makes no sense, however:&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;pcent=`egrep "noc" |awk '{print $10}'1&lt;BR /&gt;&amp;lt;&amp;lt;&lt;BR /&gt;So lets assume you get it anyway (substitute 'print 77.95' by your command):&lt;BR /&gt;&lt;BR /&gt;high=90&lt;BR /&gt;print 77.95 | awk -v h=high '{if ($1 &amp;gt;h) exit 1;exit 0}'&lt;BR /&gt;if [ $? -gt 0 ]&lt;BR /&gt;then&lt;BR /&gt;   print CPU-usage more then $high&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 26 Jul 2007 16:55:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060002#M94084</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-07-26T16:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: comparing floating point with borne shell</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060003#M94085</link>
      <description>Thanks, all the solutions that came in work.</description>
      <pubDate>Thu, 26 Jul 2007 17:07:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-floating-point-with-borne-shell/m-p/5060003#M94085</guid>
      <dc:creator>Clarence Rebolledo</dc:creator>
      <dc:date>2007-07-26T17:07:31Z</dc:date>
    </item>
  </channel>
</rss>

