<?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: Generate consolidated Report in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651996#M102434</link>
    <description>Hi,&lt;BR /&gt;try the following:&lt;BR /&gt;&lt;BR /&gt;awk 'NR==1 {nfield=NF;header=$0;next}&lt;BR /&gt;/^[0-9]/ &amp;amp;&amp;amp; NF==nfield {ids[$1]=$1;for(i=2;i&amp;lt;=NF;i++) f[$1,i]+=$i }&lt;BR /&gt;END {print (header,"\n")&lt;BR /&gt;for (id in ids) {printf(id); for(i=2;i&amp;lt;=nfield;i++) printf("\t%s",f[id,i]); printf("\n")}}' file1 .... filen&lt;BR /&gt;&lt;BR /&gt;This will ignore lines not having the identical number of fields of the first header.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
    <pubDate>Wed, 19 Oct 2005 05:03:50 GMT</pubDate>
    <dc:creator>Peter Nikitka</dc:creator>
    <dc:date>2005-10-19T05:03:50Z</dc:date>
    <item>
      <title>Generate consolidated Report</title>
      <link>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651994#M102432</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have some reports like the one attached along with this thread. I need to write a script which will create a master report with the combined data from all the reports. &lt;BR /&gt;&lt;BR /&gt;For instance in the attached report, I have &lt;BR /&gt;&lt;BR /&gt;ID Attempts Success Failure&lt;BR /&gt;&lt;BR /&gt;11   20  18 2&lt;BR /&gt;&lt;BR /&gt;I need to add Attempts,Sucess, Failure of all the ID=11 from the different files and report to the master file. Similiarly, I need to report the other IDs also.&lt;BR /&gt;&lt;BR /&gt;Also,I need to read the input file names from a configuration file.&lt;BR /&gt;&lt;BR /&gt;Please help. Either PERL or UNIX script would do.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Rahul</description>
      <pubDate>Tue, 18 Oct 2005 11:58:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651994#M102432</guid>
      <dc:creator>Rahul_13</dc:creator>
      <dc:date>2005-10-18T11:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Generate consolidated Report</title>
      <link>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651995#M102433</link>
      <description>Hi&lt;BR /&gt;this assumes all filenames *.txt and id 2 digits only.&lt;BR /&gt;Adapt when required.&lt;BR /&gt;&lt;BR /&gt;###########################################&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;grep ^[0-9][0-9]" " *.txt | cut -d":" -f2 | sort  | awk '{&lt;BR /&gt;if($1==oldid) {&lt;BR /&gt;  attempts+=$2;&lt;BR /&gt;  success+=$3;&lt;BR /&gt;  failure+=$4;&lt;BR /&gt;  }&lt;BR /&gt;  else {&lt;BR /&gt;  print oldid,attempts,success,failure;&lt;BR /&gt;  oldid=$1;&lt;BR /&gt;  attempts=$2;&lt;BR /&gt;  success=$3;&lt;BR /&gt;  failure=$4;&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;END{print oldid,attempts,success,failure;}'&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Tue, 18 Oct 2005 12:24:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651995#M102433</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2005-10-18T12:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Generate consolidated Report</title>
      <link>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651996#M102434</link>
      <description>Hi,&lt;BR /&gt;try the following:&lt;BR /&gt;&lt;BR /&gt;awk 'NR==1 {nfield=NF;header=$0;next}&lt;BR /&gt;/^[0-9]/ &amp;amp;&amp;amp; NF==nfield {ids[$1]=$1;for(i=2;i&amp;lt;=NF;i++) f[$1,i]+=$i }&lt;BR /&gt;END {print (header,"\n")&lt;BR /&gt;for (id in ids) {printf(id); for(i=2;i&amp;lt;=nfield;i++) printf("\t%s",f[id,i]); printf("\n")}}' file1 .... filen&lt;BR /&gt;&lt;BR /&gt;This will ignore lines not having the identical number of fields of the first header.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 19 Oct 2005 05:03:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651996#M102434</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2005-10-19T05:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Generate consolidated Report</title>
      <link>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651997#M102435</link>
      <description>You can try with PERL scripting as,&lt;BR /&gt;&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt;#master.pl&lt;BR /&gt;$i=0;&lt;BR /&gt;while (&amp;lt;&amp;gt;)&lt;BR /&gt;{&lt;BR /&gt;  ($id,$attempt,$success,$failure)=split;&lt;BR /&gt;  $I_arr[$id]=$id;&lt;BR /&gt;  $A_arr[$id]+=$attempt;&lt;BR /&gt;  $S_arr[$id]+=$success;&lt;BR /&gt;  $F_arr[$id]+=$failure;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;foreach $var (@I_arr)&lt;BR /&gt;{&lt;BR /&gt;  if ($var !~ /^$/)&lt;BR /&gt;  {&lt;BR /&gt;        printf "ID= $I_arr[$var] Attempt = $A_arr[$var] Success = $S_arr[$var] Failure = $F_arr[$var] \n";&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;# perl master.pl &amp;gt; master.pl&lt;BR /&gt;&lt;BR /&gt;will make it.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Wed, 19 Oct 2005 05:30:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/generate-consolidated-report/m-p/3651997#M102435</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-19T05:30:15Z</dc:date>
    </item>
  </channel>
</rss>

