<?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: Adding up columns in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425120#M980</link>
    <description>I made a typing mistake, it should be Gign instead of Gign&lt;BR /&gt;&lt;BR /&gt;Brian&lt;BR /&gt;&amp;lt;*(((&amp;gt;&amp;lt; er</description>
    <pubDate>Tue, 06 Jun 2000 16:53:17 GMT</pubDate>
    <dc:creator>Brian M. Fisher</dc:creator>
    <dc:date>2000-06-06T16:53:17Z</dc:date>
    <item>
      <title>Adding up columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425117#M977</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;I have to write a script to total a column of numbers.  For example I want to total the first column.  I am using a csh to get the data up to this point.&lt;BR /&gt;&lt;BR /&gt;3497796 /dbs&lt;BR /&gt;3479374 /dbs2&lt;BR /&gt;5799894 /dublin&lt;BR /&gt;440128  /dublin2&lt;BR /&gt;&lt;BR /&gt;Any help&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Tue, 06 Jun 2000 15:35:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425117#M977</guid>
      <dc:creator>Dave Walley</dc:creator>
      <dc:date>2000-06-06T15:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding up columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425118#M978</link>
      <description>You can use the awk. For example.&lt;BR /&gt;awk 'BEGIN {total=0} {total+=$1} END {print total}' filein &lt;BR /&gt;&lt;BR /&gt;You can redirect the stdout to another file.&lt;BR /&gt;&lt;BR /&gt;If you want to print out all stdin you can modify the script and type in something like:&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN {total=0} {total+=$1 ; print } END {print total}' filein&lt;BR /&gt;&lt;BR /&gt;I hope this helps.</description>
      <pubDate>Tue, 06 Jun 2000 16:22:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425118#M978</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2000-06-06T16:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding up columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425119#M979</link>
      <description>You can also do the following for nicer output:&lt;BR /&gt;&lt;BR /&gt;commands | awk 'BEGIN {total=0}{total += $1}&lt;BR /&gt;END {printf("%.2f Gign",total/(1024*1024))}'&lt;BR /&gt;&lt;BR /&gt;XXX.XX Gig&lt;BR /&gt;&lt;BR /&gt;Brian&lt;BR /&gt;&amp;lt;*(((&amp;gt;&amp;lt; er</description>
      <pubDate>Tue, 06 Jun 2000 16:49:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425119#M979</guid>
      <dc:creator>Brian M. Fisher</dc:creator>
      <dc:date>2000-06-06T16:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding up columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425120#M980</link>
      <description>I made a typing mistake, it should be Gign instead of Gign&lt;BR /&gt;&lt;BR /&gt;Brian&lt;BR /&gt;&amp;lt;*(((&amp;gt;&amp;lt; er</description>
      <pubDate>Tue, 06 Jun 2000 16:53:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425120#M980</guid>
      <dc:creator>Brian M. Fisher</dc:creator>
      <dc:date>2000-06-06T16:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adding up columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425121#M981</link>
      <description>The problem seems to be the backslash does not transfer to the postings:&lt;BR /&gt;&lt;BR /&gt;It should be Gig"backslash"n&lt;BR /&gt;&lt;BR /&gt;Brian&lt;BR /&gt;&amp;lt;*(((&amp;gt;&amp;lt; er</description>
      <pubDate>Tue, 06 Jun 2000 16:55:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425121#M981</guid>
      <dc:creator>Brian M. Fisher</dc:creator>
      <dc:date>2000-06-06T16:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Adding up columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425122#M982</link>
      <description>The aboce replies are correct.  For simplicity, though, the BEGIN, END, and initialization statements are not required.  You can simply do:&lt;BR /&gt;&lt;BR /&gt;&lt;COMMANDS&gt; | awk 'total+=$1 {print total}'&lt;BR /&gt;&lt;BR /&gt;(note: this provides a running total.  You do need the END statement (or a pipe to tail -1) if you want only the final total.)&lt;BR /&gt;&lt;BR /&gt;ex: bdf|awk 'total+=$3 {printf("%.2f Gig|n",total/1024/1024)}'&lt;BR /&gt;provides a total of disk space used on a system.  (note: |==backspace in the above.)&lt;/COMMANDS&gt;</description>
      <pubDate>Tue, 06 Jun 2000 19:27:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/adding-up-columns/m-p/2425122#M982</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-06-06T19:27:16Z</dc:date>
    </item>
  </channel>
</rss>

