<?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: Scripting help required in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916884#M103990</link>
    <description>If you want to have only the maximum then,&lt;BR /&gt;&lt;BR /&gt;# grep -E 'Reading|CPU UTIL' test.log | awk 'NR%3==1 { printf $0;getline;split($0,a);getline;split($0,b); if ( a[3] &amp;gt; b[3] ) { print " CPU UTIL ",a[3];}  else { print " CPU UTIL ",b[3];} }' | sort -k 11,11 | tail -1&lt;BR /&gt;&lt;BR /&gt;hth.</description>
    <pubDate>Tue, 09 Aug 2005 01:48:58 GMT</pubDate>
    <dc:creator>Muthukumar_5</dc:creator>
    <dc:date>2005-08-09T01:48:58Z</dc:date>
    <item>
      <title>Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916878#M103984</link>
      <description>Hi,&lt;BR /&gt;All,&lt;BR /&gt;Please find the content of the file below.I want to extract the field CPU UTIL having the maximum value along with the time stamp which is just 1 line above it.&lt;BR /&gt;&lt;BR /&gt;The content of file is as follows.&lt;BR /&gt;&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;Reading at Mon Aug  8 00:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           36.0&lt;BR /&gt;GBL MEM UTIL       50.3&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           42.7&lt;BR /&gt;GBL MEM UTIL       50.3&lt;BR /&gt;GBL DISK PEAK UTIL      99.1&lt;BR /&gt;Reading at Mon Aug  8 00:30:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           31.6&lt;BR /&gt;GBL MEM UTIL       50.7&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           36.9&lt;BR /&gt;GBL MEM UTIL       50.7&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 01:00:01 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           38.9&lt;BR /&gt;GBL MEM UTIL       51.2&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           42.9&lt;BR /&gt;GBL MEM UTIL       51.2&lt;BR /&gt;GBL DISK PEAK UTIL      89.8&lt;BR /&gt;Reading at Mon Aug  8 01:30:01 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           44.8&lt;BR /&gt;GBL MEM UTIL       51.5&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           45.1&lt;BR /&gt;GBL MEM UTIL       51.5&lt;BR /&gt;GBL DISK PEAK UTIL      86.3&lt;BR /&gt;Reading at Mon Aug  8 02:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           40.5&lt;BR /&gt;GBL MEM UTIL       50.2&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           41.4&lt;BR /&gt;GBL MEM UTIL       50.2&lt;BR /&gt;GBL DISK PEAK UTIL      70.7&lt;BR /&gt;Reading at Mon Aug  8 02:30:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           36.8&lt;BR /&gt;GBL MEM UTIL       49.5&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           38.1&lt;BR /&gt;GBL MEM UTIL       49.4&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 03:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           35.1&lt;BR /&gt;GBL MEM UTIL       49.7&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           29.8&lt;BR /&gt;GBL MEM UTIL       49.7&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 03:30:01 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           46.8&lt;BR /&gt;GBL MEM UTIL       50.2&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           42.9&lt;BR /&gt;GBL MEM UTIL       50.3&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 04:00:01 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           33.1&lt;BR /&gt;GBL MEM UTIL       50.1&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           24.2&lt;BR /&gt;GBL MEM UTIL       50.1&lt;BR /&gt;GBL DISK PEAK UTIL      99.3&lt;BR /&gt;Reading at Mon Aug  8 04:30:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           31.3&lt;BR /&gt;GBL MEM UTIL       50.1&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           30.3&lt;BR /&gt;GBL MEM UTIL       50.1&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 05:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           25.2&lt;BR /&gt;GBL MEM UTIL       50.5&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           33.5&lt;BR /&gt;GBL MEM UTIL       50.5&lt;BR /&gt;GBL DISK PEAK UTIL      99.3&lt;BR /&gt;Reading at Mon Aug  8 05:30:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           16.0&lt;BR /&gt;GBL MEM UTIL       50.9&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           24.4&lt;BR /&gt;GBL MEM UTIL       50.9&lt;BR /&gt;GBL DISK PEAK UTIL      85.8&lt;BR /&gt;Reading at Mon Aug  8 06:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           19.5&lt;BR /&gt;GBL MEM UTIL       50.8&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           37.8&lt;BR /&gt;GBL MEM UTIL       50.8&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 06:30:01 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           50.0&lt;BR /&gt;GBL MEM UTIL       50.2&lt;BR /&gt;GBL DISK PEAK UTIL      95.2&lt;BR /&gt;CPU UTIL           43.2&lt;BR /&gt;GBL MEM UTIL       50.2&lt;BR /&gt;GBL DISK PEAK UTIL      91.6&lt;BR /&gt;Reading at Mon Aug  8 07:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           36.1&lt;BR /&gt;GBL MEM UTIL       50.9&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           33.8&lt;BR /&gt;GBL MEM UTIL       50.9&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 07:30:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           28.1&lt;BR /&gt;GBL MEM UTIL       50.9&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           30.3&lt;BR /&gt;GBL MEM UTIL       50.8&lt;BR /&gt;GBL DISK PEAK UTIL      88.1&lt;BR /&gt;Reading at Mon Aug  8 08:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           52.3&lt;BR /&gt;GBL MEM UTIL       50.9&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           49.1&lt;BR /&gt;GBL MEM UTIL       50.8&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 08:30:01 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           43.5&lt;BR /&gt;GBL MEM UTIL       50.8&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           48.1&lt;BR /&gt;GBL MEM UTIL       50.8&lt;BR /&gt;GBL DISK PEAK UTIL      93.3&lt;BR /&gt;Reading at Mon Aug  8 09:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           33.8&lt;BR /&gt;GBL MEM UTIL       51.4&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           24.7&lt;BR /&gt;GBL MEM UTIL       51.3&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 09:30:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           25.9&lt;BR /&gt;GBL MEM UTIL       52.5&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           28.4&lt;BR /&gt;GBL MEM UTIL       52.5&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 10:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           56.9&lt;BR /&gt;GBL MEM UTIL       56.2&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           49.7&lt;BR /&gt;GBL MEM UTIL       56.2&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 10:30:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           57.5&lt;BR /&gt;GBL MEM UTIL       57.6&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           51.4&lt;BR /&gt;GBL MEM UTIL       57.6&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;Reading at Mon Aug  8 11:00:00 IST 2005 &lt;BR /&gt;&lt;BR /&gt;CPU UTIL           63.4&lt;BR /&gt;GBL MEM UTIL       60.5&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;CPU UTIL           69.8&lt;BR /&gt;GBL MEM UTIL       60.4&lt;BR /&gt;GBL DISK PEAK UTIL     100.0&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Aug 2005 00:58:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916878#M103984</guid>
      <dc:creator>Corporate Unix01</dc:creator>
      <dc:date>2005-08-09T00:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916879#M103985</link>
      <description>The first thing that comes to my head is:&lt;BR /&gt;&lt;BR /&gt;cat output.file | grep "CPU UTIL" | awk '{print $3}' | sort -n | tail -1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Explanation:&lt;BR /&gt;1) Cat the file content&lt;BR /&gt;2) Filter only the "CPU UTIL" lines&lt;BR /&gt;3) Cut from there only the number&lt;BR /&gt;4) Sort the number is asc oreder&lt;BR /&gt;5) Show me the last line &amp;lt;- maximum number.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Alex.</description>
      <pubDate>Tue, 09 Aug 2005 01:30:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916879#M103985</guid>
      <dc:creator>Alex Lavrov.</dc:creator>
      <dc:date>2005-08-09T01:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916880#M103986</link>
      <description>Alex,&lt;BR /&gt;Thanks.&lt;BR /&gt;cat output.file | grep "CPU UTIL" | awk '{print $3}' | sort -n | tail -1.&lt;BR /&gt;This gives me the the max value.now my requirement is to get the timestamp that is the date which is in the file just a line above.&lt;BR /&gt;How to do that ?&lt;BR /&gt;This is the actual requirement.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 09 Aug 2005 01:37:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916880#M103986</guid>
      <dc:creator>Corporate Unix01</dc:creator>
      <dc:date>2005-08-09T01:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916881#M103987</link>
      <description>In that command, please NEVER use step 1&lt;BR /&gt;&lt;BR /&gt;# grep "CPU UTIL" output.file | awk '{print $3}' | sort -n | tail -1&lt;BR /&gt;&lt;BR /&gt;It's a plain waste of system resources&lt;BR /&gt;Perl can do it in a single command&lt;BR /&gt;&lt;BR /&gt;# perl -ne'print+(sort{$b&amp;lt;=&amp;gt;$a}grep s/CPU UTIL //,&amp;lt;&amp;gt;)[0]' output.file&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Aug 2005 01:39:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916881#M103987</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-08-09T01:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916882#M103988</link>
      <description>You can do this as,&lt;BR /&gt;&lt;BR /&gt;Put this information into a log file called test.log.&lt;BR /&gt;&lt;BR /&gt;# grep -E 'Reading|CPU UTIL' test.log | awk 'NR%3==1 { print $0;getline;split($0,a);getline;split($0,b); if ( a[3] &amp;gt; b[3] ) { print "CPU UTIL ",a[3];}  else { print "CPU UTIL ",b[3];} }'&lt;BR /&gt;&lt;BR /&gt;Reading at Mon Aug 8 00:00:00 IST 2005&lt;BR /&gt;CPU UTIL  42.7&lt;BR /&gt;Reading at Mon Aug 8 00:30:00 IST 2005&lt;BR /&gt;CPU UTIL  36.9&lt;BR /&gt;Reading at Mon Aug 8 01:00:01 IST 2005&lt;BR /&gt;CPU UTIL  42.9&lt;BR /&gt;Reading at Mon Aug 8 01:30:01 IST 2005&lt;BR /&gt;CPU UTIL  45.1&lt;BR /&gt;Reading at Mon Aug 8 02:00:00 IST 2005&lt;BR /&gt;CPU UTIL  41.4&lt;BR /&gt;Reading at Mon Aug 8 02:30:00 IST 2005&lt;BR /&gt;CPU UTIL  38.1&lt;BR /&gt;Reading at Mon Aug 8 03:00:00 IST 2005&lt;BR /&gt;CPU UTIL  35.1&lt;BR /&gt;Reading at Mon Aug 8 03:30:01 IST 2005&lt;BR /&gt;CPU UTIL  46.8&lt;BR /&gt;Reading at Mon Aug 8 04:00:01 IST 2005&lt;BR /&gt;CPU UTIL  33.1&lt;BR /&gt;Reading at Mon Aug 8 04:30:00 IST 2005&lt;BR /&gt;CPU UTIL  31.3&lt;BR /&gt;Reading at Mon Aug 8 05:00:00 IST 2005&lt;BR /&gt;CPU UTIL  33.5&lt;BR /&gt;Reading at Mon Aug 8 05:30:00 IST 2005&lt;BR /&gt;CPU UTIL  24.4&lt;BR /&gt;Reading at Mon Aug 8 06:00:00 IST 2005&lt;BR /&gt;CPU UTIL  37.8&lt;BR /&gt;Reading at Mon Aug 8 06:30:01 IST 2005&lt;BR /&gt;CPU UTIL  50.0&lt;BR /&gt;Reading at Mon Aug 8 07:00:00 IST 2005&lt;BR /&gt;CPU UTIL  36.1&lt;BR /&gt;Reading at Mon Aug 8 07:30:00 IST 2005&lt;BR /&gt;CPU UTIL  30.3&lt;BR /&gt;Reading at Mon Aug 8 08:00:00 IST 2005&lt;BR /&gt;CPU UTIL  52.3&lt;BR /&gt;Reading at Mon Aug 8 08:30:01 IST 2005&lt;BR /&gt;CPU UTIL  48.1&lt;BR /&gt;Reading at Mon Aug 8 09:00:00 IST 2005&lt;BR /&gt;CPU UTIL  33.8&lt;BR /&gt;Reading at Mon Aug 8 09:30:00 IST 2005&lt;BR /&gt;CPU UTIL  28.4&lt;BR /&gt;Reading at Mon Aug 8 10:00:00 IST 2005&lt;BR /&gt;CPU UTIL  56.9&lt;BR /&gt;Reading at Mon Aug 8 10:30:00 IST 2005&lt;BR /&gt;CPU UTIL  57.5&lt;BR /&gt;Reading at Mon Aug 8 11:00:00 IST 2005&lt;BR /&gt;CPU UTIL  69.8&lt;BR /&gt;&lt;BR /&gt;let us know if you need some other format of output.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 09 Aug 2005 01:40:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916882#M103988</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-08-09T01:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916883#M103989</link>
      <description>But that reply was just a comment on the process before it, that did not show the time stamp.&lt;BR /&gt;&lt;BR /&gt;perl -nle'chomp;s/^Reading at // and$t=$_;s/^CPU UTIL // and$c{$_}=$t}END{@t=sort{$b&amp;lt;=&amp;gt;$a}keys%c;print"$c{$t[0]}: $t[0]"' output.file&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Tue, 09 Aug 2005 01:44:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916883#M103989</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-08-09T01:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916884#M103990</link>
      <description>If you want to have only the maximum then,&lt;BR /&gt;&lt;BR /&gt;# grep -E 'Reading|CPU UTIL' test.log | awk 'NR%3==1 { printf $0;getline;split($0,a);getline;split($0,b); if ( a[3] &amp;gt; b[3] ) { print " CPU UTIL ",a[3];}  else { print " CPU UTIL ",b[3];} }' | sort -k 11,11 | tail -1&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 09 Aug 2005 01:48:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916884#M103990</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-08-09T01:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916885#M103991</link>
      <description>Thanks MuthuKumar and H.Merijn&lt;BR /&gt;&lt;BR /&gt;The response was amazing.&lt;BR /&gt;&lt;BR /&gt;Thanks for all your support.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Aug 2005 01:53:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help-required/m-p/4916885#M103991</guid>
      <dc:creator>Corporate Unix01</dc:creator>
      <dc:date>2005-08-09T01:53:43Z</dc:date>
    </item>
  </channel>
</rss>

