<?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 Shell Script Assistance in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575734#M228939</link>
    <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Need some Shell expertise help.&lt;BR /&gt;I have input file that contain 2 fields(started date &amp;amp; Size).&lt;BR /&gt;input file example:&lt;BR /&gt;Started     Kbyte&lt;BR /&gt;29/6/05     9000&lt;BR /&gt;29/6/05     1000&lt;BR /&gt;29/6/05     4000&lt;BR /&gt;30/6/05     2000&lt;BR /&gt;30/6/05     7000&lt;BR /&gt;&lt;BR /&gt;How could I total-up the Size(Kbyte) group by Started field. &lt;BR /&gt;&lt;BR /&gt;TQ.&lt;BR /&gt;</description>
    <pubDate>Mon, 04 Jul 2005 07:35:33 GMT</pubDate>
    <dc:creator>KAMARULZAMAN HJ ALI</dc:creator>
    <dc:date>2005-07-04T07:35:33Z</dc:date>
    <item>
      <title>Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575734#M228939</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Need some Shell expertise help.&lt;BR /&gt;I have input file that contain 2 fields(started date &amp;amp; Size).&lt;BR /&gt;input file example:&lt;BR /&gt;Started     Kbyte&lt;BR /&gt;29/6/05     9000&lt;BR /&gt;29/6/05     1000&lt;BR /&gt;29/6/05     4000&lt;BR /&gt;30/6/05     2000&lt;BR /&gt;30/6/05     7000&lt;BR /&gt;&lt;BR /&gt;How could I total-up the Size(Kbyte) group by Started field. &lt;BR /&gt;&lt;BR /&gt;TQ.&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Jul 2005 07:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575734#M228939</guid>
      <dc:creator>KAMARULZAMAN HJ ALI</dc:creator>
      <dc:date>2005-07-04T07:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575735#M228940</link>
      <description>two quick (&amp;amp; dirty?) solutions:&lt;BR /&gt;&lt;BR /&gt;sum=0&lt;BR /&gt;grep -v Kbyte &lt;INPUTFILE&gt;|awk '{print $2}'|while read num &lt;BR /&gt;do &lt;BR /&gt;  sum=$((sum+num))&lt;BR /&gt;done&lt;BR /&gt;echo $sum&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;echo `grep -v Kbyte &lt;INPUTFILE&gt; | awk '{printf $2;while (getline) { printf "+"$2; }}'` | bc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;/INPUTFILE&gt;&lt;/INPUTFILE&gt;</description>
      <pubDate>Mon, 04 Jul 2005 08:10:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575735#M228940</guid>
      <dc:creator>Kasper Hedensted</dc:creator>
      <dc:date>2005-07-04T08:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575736#M228941</link>
      <description>Ups, you need to sort the dates first&lt;BR /&gt;&lt;BR /&gt;dates=`grep -v ^Started &lt;INPUTFILE&gt; |awk '{print $1}' |sort -u`&lt;BR /&gt;&lt;BR /&gt;for date in $dates&lt;BR /&gt;do&lt;BR /&gt;  sum=0&lt;BR /&gt;  grep ^$date &lt;INPUTFILE&gt; | awk '{print $2}'| while read num&lt;BR /&gt;  do &lt;BR /&gt;    sum=$((sum+num))&lt;BR /&gt;  done&lt;BR /&gt;  echo $date $sum&lt;BR /&gt;done&lt;/INPUTFILE&gt;&lt;/INPUTFILE&gt;</description>
      <pubDate>Mon, 04 Jul 2005 08:18:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575736#M228941</guid>
      <dc:creator>Kasper Hedensted</dc:creator>
      <dc:date>2005-07-04T08:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575737#M228942</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;try this:&lt;BR /&gt;&lt;BR /&gt;awk 'NR==1 {unit=$2;next}&lt;BR /&gt;{s+=$2}&lt;BR /&gt;END {printf("%s %s\n,s,unit)}' inputfile&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 04 Jul 2005 10:21:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575737#M228942</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2005-07-04T10:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575738#M228943</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;to add the date:&lt;BR /&gt;&lt;BR /&gt;awk 'NR==1 {unit=$2;next}&lt;BR /&gt;{s+=$2; date=$1}&lt;BR /&gt;END {printf("%s %s %s\n,date,s,unit)}' inputfile</description>
      <pubDate>Mon, 04 Jul 2005 11:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575738#M228943</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2005-07-04T11:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575739#M228944</link>
      <description>cat yourFile |&lt;BR /&gt;awk '&lt;BR /&gt;NR=1 {print $0;next;}&lt;BR /&gt;{a[$1]=+$2;}&lt;BR /&gt;END {&lt;BR /&gt;for ( i in a ) print i, a[i];&lt;BR /&gt;} | sort -n</description>
      <pubDate>Mon, 04 Jul 2005 11:49:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575739#M228944</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2005-07-04T11:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575740#M228945</link>
      <description>Thanks All,&lt;BR /&gt;&lt;BR /&gt;Another enhancement to the script,&lt;BR /&gt;&lt;BR /&gt;How do I produce the output like this :&lt;BR /&gt;&lt;BR /&gt;Started Kbyte Total&lt;BR /&gt;29/6/05 9000&lt;BR /&gt;29/6/05 1000&lt;BR /&gt;29/6/05 4000 14000&lt;BR /&gt;30/6/05 2000&lt;BR /&gt;30/6/05 7000 9000&lt;BR /&gt;&lt;BR /&gt;TQ</description>
      <pubDate>Tue, 05 Jul 2005 10:38:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575740#M228945</guid>
      <dc:creator>KAMARULZAMAN HJ ALI</dc:creator>
      <dc:date>2005-07-05T10:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Script Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575741#M228946</link>
      <description>Try-&lt;BR /&gt; &lt;BR /&gt;awk 'prev1!=$1{if (NR &amp;gt; 1) printf " %s",s;prev1=$1;s=0};END{printf " %s\n",s};{s=s+$2;printf "\n%s",$&lt;BR /&gt;0}'&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;Rod Hills&lt;BR /&gt; &lt;BR /&gt;PS- Assign points as your peers have helped you...</description>
      <pubDate>Tue, 05 Jul 2005 12:50:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-assistance/m-p/3575741#M228946</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2005-07-05T12:50:46Z</dc:date>
    </item>
  </channel>
</rss>

