<?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: summary colums in shell script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140073#M93396</link>
    <description>Jairo,&lt;BR /&gt;&lt;BR /&gt;Please READ, and study, the exampled provided.&lt;BR /&gt;And please spend a few minuted with the man pages for AWK.&lt;BR /&gt;&lt;BR /&gt;For example, in the last post you used:&lt;BR /&gt;&lt;BR /&gt;awk '{print $5}'|sed '/^$/d'|grep -v too|grep -v shrt&lt;BR /&gt;&lt;BR /&gt;This last 3 pipes appear to perform an inneficient, and error prone, removal of the first 3 lines from awk.&lt;BR /&gt;&lt;BR /&gt;But our friend James already spend some time showing us how to do this elegantly, fast, and safe. All that 'crud' can be replaced by:&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;3 {print $5}'&lt;BR /&gt;&lt;BR /&gt;And awk can just read from a file. No cat needed:&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;3 {print $5}' logwcrc&lt;BR /&gt;&lt;BR /&gt;And awk will happily do the extra condition testing 'for free'&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;3 &amp;amp;&amp;amp; $5&amp;gt;20 {print "CRC ERROR ACUMULADO de " $5} logwcrc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Many happy learnings.&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 11 Feb 2008 20:17:30 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2008-02-11T20:17:30Z</dc:date>
    <item>
      <title>summary colums in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140067#M93390</link>
      <description>Hi , &lt;BR /&gt;&lt;BR /&gt;2 questions:&lt;BR /&gt;&lt;BR /&gt;1. I question,  how to calculate sum of all average in each item total crc/err linkfail and loss sync for each port .&lt;BR /&gt;example :&lt;BR /&gt;for port  0:  , total  crcerr,linkfail,losssync&lt;BR /&gt;these fields change constantly in each sleep 60 &lt;BR /&gt;port 1: ...&lt;BR /&gt;&lt;BR /&gt;2. and when the field is different of 0 display average or diferent of 0 , diplay in standart oupout for each port&lt;BR /&gt;0:&lt;BR /&gt;1:&lt;BR /&gt;2:&lt;BR /&gt;&lt;BR /&gt; It really helped me. Thank you.&lt;BR /&gt;&lt;BR /&gt;columns 5,11,12(crc error, linkfail, losssync&lt;BR /&gt;&lt;BR /&gt;attach log file &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Feb 2008 19:40:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140067#M93390</guid>
      <dc:creator>Jairo Campana</dc:creator>
      <dc:date>2008-02-04T19:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: summary colums in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140068#M93391</link>
      <description>Hi Jairo:&lt;BR /&gt;&lt;BR /&gt;You can use 'awk' to perform the matching and arithmetic.  For example, to output only the lines with a non-zero value in field-12, and print the average of the column's value at the end, you could do something like:&lt;BR /&gt;&lt;BR /&gt;# mycommand | awk 'NR&amp;gt;3 {if ($12~/k/) {F12=$12*1024} else {F12=$12};SUM+=F12;if (F12&amp;gt;0) {print}};END{print SUM/(NR-3)}'&lt;BR /&gt;&lt;BR /&gt;Notice that I accounted for values with a 'k' magnitude by multiplying the value by 1024.  You would need to embellish this logical to handle values with 'm' (1024*1024).  The header lines (1-3) are skipped, and of course, not counted in computing the average.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 04 Feb 2008 20:30:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140068#M93391</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-04T20:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: summary colums in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140069#M93392</link>
      <description>Jairo,&lt;BR /&gt;&lt;BR /&gt;The desired output description is a little terse, and possibly suggests a misunderstanding of the data presented.&lt;BR /&gt;&lt;BR /&gt;First, This is the output of 'portErrShow' for a Brocade SAn switch isn't it?&lt;BR /&gt;Please indicate so!&lt;BR /&gt;So it is possibly more a Storage forum question than HPUX isn't it?&lt;BR /&gt;&lt;BR /&gt;Second, Best I know (and I may well be wrong!) those error rates are accumulated already. So you really want to subtract the prior value from the current value to see what happened this period.&lt;BR /&gt;&lt;BR /&gt;Third, these error counters are really only relevant as a proportion to the actual traffic. Some might suggest that an error rate up to 0.5% of the traffic is still acceptable. There is not a very clear example of this in your output, but take port 11 and 12. Similar error counts, but 1000x more traffic for #11, so the fewer errors on #12 may still be more significant.&lt;BR /&gt;&lt;BR /&gt;Fourth, there may have been an 'episode' since repaired / dissapeared causing a high static values. So you may want a rolling average over an hour or over 24 hours, requiring some sort of memory in the calculations, possibly spooling all to disk and reporting from there.&lt;BR /&gt;&lt;BR /&gt;Finally, try to get a timestamp in the output. It may be blatantly obvious to you today that this was done at 1 minute intervals, but that is not clear to a processing script. And just in case the report get's stalled for some time it would be nice to eb able to 'see' that in averaging.&lt;BR /&gt;&lt;BR /&gt;Hopefully the questions above help you define the output better!&lt;BR /&gt;&lt;BR /&gt;Hope this helps some,&lt;BR /&gt;Hein van den Heuvel (at gmail dot com)&lt;BR /&gt;HvdH Performance Consulting&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Feb 2008 01:05:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140069#M93392</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-02-05T01:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: summary colums in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140070#M93393</link>
      <description>THANKS JAMES:&lt;BR /&gt;&lt;BR /&gt;yes Its work , now need analisys the result and print the result, howto &lt;BR /&gt;example:&lt;BR /&gt;in the while true the values change each "sleep 5"&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;cat logwcrc|awk '{print $5}'&lt;BR /&gt;sleep 2&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I need in each value for the row one condition in while true read , compare if value &amp;gt; 10,  assign en variable SUM, in the following evaluation compare the last value store in the variable if SUM &amp;gt; 30 then report $SUM, else return evaluation or finish&lt;BR /&gt;&lt;BR /&gt;the value in each row to the result evaluate , print to a flank example&lt;BR /&gt;&lt;BR /&gt;cat logwcrc|awk '{print $5}'&lt;BR /&gt;# cat logwcrc|awk '{print $5}'&lt;BR /&gt;&lt;BR /&gt;1  &lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;...&lt;BR /&gt;15  SUM=20&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Feb 2008 19:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140070#M93393</guid>
      <dc:creator>Jairo Campana</dc:creator>
      <dc:date>2008-02-11T19:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: summary colums in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140071#M93394</link>
      <description>I create the following script :&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;for i in `cat logwcrc|awk '{print $5}'|sed '/^$/d'|grep -v too|grep -v shrt`&lt;BR /&gt;do&lt;BR /&gt; if [ $i -gt 10 ]&lt;BR /&gt; then&lt;BR /&gt;   SUM=$i&lt;BR /&gt;  if [ $SUM -gt 20 ]&lt;BR /&gt;  then&lt;BR /&gt;    echo "CRC ERROR ACUMULADO de $SUM"&lt;BR /&gt;  fi&lt;BR /&gt; fi&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Feb 2008 19:53:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140071#M93394</guid>
      <dc:creator>Jairo Campana</dc:creator>
      <dc:date>2008-02-11T19:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: summary colums in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140072#M93395</link>
      <description>I cant use to &lt;BR /&gt;while read i j&lt;BR /&gt;do&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; $LIST</description>
      <pubDate>Mon, 11 Feb 2008 20:07:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140072#M93395</guid>
      <dc:creator>Jairo Campana</dc:creator>
      <dc:date>2008-02-11T20:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: summary colums in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140073#M93396</link>
      <description>Jairo,&lt;BR /&gt;&lt;BR /&gt;Please READ, and study, the exampled provided.&lt;BR /&gt;And please spend a few minuted with the man pages for AWK.&lt;BR /&gt;&lt;BR /&gt;For example, in the last post you used:&lt;BR /&gt;&lt;BR /&gt;awk '{print $5}'|sed '/^$/d'|grep -v too|grep -v shrt&lt;BR /&gt;&lt;BR /&gt;This last 3 pipes appear to perform an inneficient, and error prone, removal of the first 3 lines from awk.&lt;BR /&gt;&lt;BR /&gt;But our friend James already spend some time showing us how to do this elegantly, fast, and safe. All that 'crud' can be replaced by:&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;3 {print $5}'&lt;BR /&gt;&lt;BR /&gt;And awk can just read from a file. No cat needed:&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;3 {print $5}' logwcrc&lt;BR /&gt;&lt;BR /&gt;And awk will happily do the extra condition testing 'for free'&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;3 &amp;amp;&amp;amp; $5&amp;gt;20 {print "CRC ERROR ACUMULADO de " $5} logwcrc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Many happy learnings.&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Feb 2008 20:17:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/summary-colums-in-shell-script/m-p/4140073#M93396</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-02-11T20:17:30Z</dc:date>
    </item>
  </channel>
</rss>

