<?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: how can add two variables? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792307#M80048</link>
    <description>Harry,&lt;BR /&gt;&lt;BR /&gt;Nicely, put! You are getting more diplomatic in your old age? Or are you getting tired of the flaming tirades?&lt;BR /&gt;&lt;BR /&gt;:-)&lt;BR /&gt;Marty &lt;WHO likes="" harry=""&gt;&lt;/WHO&gt;</description>
    <pubDate>Fri, 23 Aug 2002 19:03:54 GMT</pubDate>
    <dc:creator>Martin Johnson</dc:creator>
    <dc:date>2002-08-23T19:03:54Z</dc:date>
    <item>
      <title>how can add two variables?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792302#M80043</link>
      <description>Example:&lt;BR /&gt;&lt;BR /&gt;in the next scrip i have the next script:&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------&lt;BR /&gt;#Progrma que calcula el total de memoria #utilizada&lt;BR /&gt;&lt;BR /&gt;ps aux |cut -b 34-37 |grep K | awk '{s=s+$1}\{r=s/1024}END{print r,export $r}'&lt;BR /&gt;&lt;BR /&gt;ps aux | cut -b 34-37 | grep M | awk '{t=t+$1}\END{print t}'&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------&lt;BR /&gt;&lt;BR /&gt;but i need sum both and print the result&lt;BR /&gt;how can doing it?&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Aug 2002 22:22:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792302#M80043</guid>
      <dc:creator>mariano_4</dc:creator>
      <dc:date>2002-08-22T22:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: how can add two variables?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792303#M80044</link>
      <description>Mariano,&lt;BR /&gt;&lt;BR /&gt;TIMEOUT&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;export $r ???&lt;BR /&gt;&lt;BR /&gt;Might work in LINUX but not in any UNIX that I know of, UNLESS you plan on installing GNU's AWK!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now, how to do it:&lt;BR /&gt;&lt;BR /&gt;ps aux | cut -b 34-37 | grep -e K -e M | &lt;BR /&gt;awk '{lenofvar=length($1);&lt;BR /&gt;if (substr($1,lenofvar,1) eq "K") {s=s+$1;r=s/1024}&lt;BR /&gt;if (substr($1,lenofvar,1) eq "M") {t=t+$1}&lt;BR /&gt;}&lt;BR /&gt;END{printf "%d/n",r;&lt;BR /&gt;print t}'&lt;BR /&gt;&lt;BR /&gt;Can't test it, but looks good???&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 22 Aug 2002 22:39:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792303#M80044</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-08-22T22:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: how can add two variables?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792304#M80045</link>
      <description>&lt;BR /&gt;I'd like you to take a look at this thread. It helps you and everyone else in the future:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x022718276953d61190040090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x022718276953d61190040090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And I'd like to add that you need to be more interactive with your thread so that people know what works and what doesn't.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Fri, 23 Aug 2002 00:07:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792304#M80045</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-08-23T00:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: how can add two variables?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792305#M80046</link>
      <description>First you have to assign the output to the variables, then add them, then print the sum.&lt;BR /&gt;&lt;BR /&gt;Assign:&lt;BR /&gt;variable=`command`&lt;BR /&gt;or&lt;BR /&gt;variable=$(command)&lt;BR /&gt;&lt;BR /&gt;Add:&lt;BR /&gt;((result=$var1+$var2))&lt;BR /&gt;&lt;BR /&gt;Print:&lt;BR /&gt;echo $result</description>
      <pubDate>Fri, 23 Aug 2002 08:59:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792305#M80046</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2002-08-23T08:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: how can add two variables?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792306#M80047</link>
      <description>Postscript to Frank's email:&lt;BR /&gt;&lt;BR /&gt;((result = var1 + var2)) &lt;BR /&gt;&lt;BR /&gt;or &lt;BR /&gt;&lt;BR /&gt;let result=var1+var2 &lt;BR /&gt;&lt;BR /&gt;are also both acceptable. &lt;BR /&gt;&lt;BR /&gt;-Allan</description>
      <pubDate>Fri, 23 Aug 2002 18:56:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792306#M80047</guid>
      <dc:creator>Allan Pincus</dc:creator>
      <dc:date>2002-08-23T18:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: how can add two variables?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792307#M80048</link>
      <description>Harry,&lt;BR /&gt;&lt;BR /&gt;Nicely, put! You are getting more diplomatic in your old age? Or are you getting tired of the flaming tirades?&lt;BR /&gt;&lt;BR /&gt;:-)&lt;BR /&gt;Marty &lt;WHO likes="" harry=""&gt;&lt;/WHO&gt;</description>
      <pubDate>Fri, 23 Aug 2002 19:03:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-can-add-two-variables/m-p/2792307#M80048</guid>
      <dc:creator>Martin Johnson</dc:creator>
      <dc:date>2002-08-23T19:03:54Z</dc:date>
    </item>
  </channel>
</rss>

