<?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: Please help.. a clever script needed to... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237961#M173166</link>
    <description>Of course there are a lot of solutions possible. My solution would be something with AWK...&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILE&gt; | awk '&lt;BR /&gt;/SEVERITY/ &amp;amp;&amp;amp; /Critical/ { crit=1 }&lt;BR /&gt;crit==1 { print }&lt;BR /&gt;/^$/ { crit=0 }'&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
    <pubDate>Fri, 02 Apr 2004 06:01:01 GMT</pubDate>
    <dc:creator>Elmar P. Kolkman</dc:creator>
    <dc:date>2004-04-02T06:01:01Z</dc:date>
    <item>
      <title>Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237960#M173165</link>
      <description>Hi All... please help!&lt;BR /&gt;&lt;BR /&gt;I have an ASCII file containing hundreds of ITO/OVO Errors, in a format as follows:-&lt;BR /&gt;&lt;BR /&gt;SEVERITY Critical&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "Big problems with this jobby"&lt;BR /&gt;&lt;BR /&gt;SEVERITY Warning&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "Warning, some problems in jobby" &lt;BR /&gt;&lt;BR /&gt;SEVERITY Critical&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "Mad problems with this jobby" &lt;BR /&gt;&lt;BR /&gt;SEVERITY Normal&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "This job is OK!" &lt;BR /&gt;&lt;BR /&gt;SEVERITY Critical&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "I'd check this one out"&lt;BR /&gt;&lt;BR /&gt;...and I need to extract all the Critical instances to a seprate ASCII file. For example, I need to capture every instance of "SEVERITY Critical", and the four lines that follow this statement, and place them in a seperate file, and continue the search in the original file for the next instance, so at the end, I will have a file which reads:-&lt;BR /&gt;&lt;BR /&gt;SEVERITY Critical&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "Big problems with this jobby"&lt;BR /&gt;&lt;BR /&gt;SEVERITY Critical&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "Mad problems with this jobby"&lt;BR /&gt;&lt;BR /&gt;SEVERITY Critical&lt;BR /&gt;APPLICATION "MPG"&lt;BR /&gt;MSGGRP "OS"&lt;BR /&gt;OBJECT "peanut"&lt;BR /&gt;TEXT "I'd check this one out"&lt;BR /&gt;&lt;BR /&gt;...now I beleive a while read statement will acheive this for me, but my Unix scripting not being what it should be.. I turn to you guys for assistance on this. Can anyone provide a script to do this.. or is it actually possible?? (I am sure it must be!)&lt;BR /&gt;&lt;BR /&gt;Many thanks in advace.....  &lt;BR /&gt;  &lt;BR /&gt;</description>
      <pubDate>Fri, 02 Apr 2004 05:54:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237960#M173165</guid>
      <dc:creator>Donnie Darko_1</dc:creator>
      <dc:date>2004-04-02T05:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237961#M173166</link>
      <description>Of course there are a lot of solutions possible. My solution would be something with AWK...&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILE&gt; | awk '&lt;BR /&gt;/SEVERITY/ &amp;amp;&amp;amp; /Critical/ { crit=1 }&lt;BR /&gt;crit==1 { print }&lt;BR /&gt;/^$/ { crit=0 }'&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
      <pubDate>Fri, 02 Apr 2004 06:01:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237961#M173166</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-02T06:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237962#M173167</link>
      <description>perl -ne 'print if /Critical/../^\s+$/' /path/to/error.log</description>
      <pubDate>Fri, 02 Apr 2004 06:02:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237962#M173167</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-04-02T06:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237963#M173168</link>
      <description>example &lt;BR /&gt;awk '/SEVERITY Critical/,/^\n/{print $0}' file.txt</description>
      <pubDate>Fri, 02 Apr 2004 06:05:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237963#M173168</guid>
      <dc:creator>piotr wienckiewicz</dc:creator>
      <dc:date>2004-04-02T06:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237964#M173169</link>
      <description>Get GNU grep fgrep. This grep can grep a pattern and show x lines after grep pattern.&lt;BR /&gt;&lt;BR /&gt;You can get GNU grep at HP porting centre.&lt;BR /&gt;This came up few times in the week. Search the forums.&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Fri, 02 Apr 2004 06:06:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237964#M173169</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-04-02T06:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237965#M173170</link>
      <description>Or, using sed:&lt;BR /&gt;cat &lt;FILE&gt; | sed -n 's/SEVERITY Critical/,/^$/p'&lt;/FILE&gt;</description>
      <pubDate>Fri, 02 Apr 2004 06:10:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237965#M173170</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-02T06:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237966#M173171</link>
      <description>sed -n '/SEVERITY Critical/,/^$/p' &amp;lt; your_file&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Fri, 02 Apr 2004 06:17:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237966#M173171</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-04-02T06:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237967#M173172</link>
      <description>Sorry, RAC is right. I had a 's' too much in the sed command when re-typing the command (ITRC is not open on my X-terminal, so I can not copy/paste commands...)</description>
      <pubDate>Fri, 02 Apr 2004 06:32:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237967#M173172</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-02T06:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237968#M173173</link>
      <description>another awk solution :&lt;BR /&gt;awk '{&lt;BR /&gt;if(substr($0,1,17)=="SEVERITY Critical") {&lt;BR /&gt;  for(i=0; i &amp;lt; 5;i++) {print $0; getline;}&lt;BR /&gt; }&lt;BR /&gt;}' &lt;YOURFILE&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jean-Luc&lt;/YOURFILE&gt;</description>
      <pubDate>Fri, 02 Apr 2004 06:32:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237968#M173173</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2004-04-02T06:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237969#M173174</link>
      <description>my mistake&lt;BR /&gt;&lt;BR /&gt;not&lt;BR /&gt;awk '/SEVERITY Critical/,/^\n/{print $0}' file.txt&lt;BR /&gt;&lt;BR /&gt;only&lt;BR /&gt;awk '/SEVERITY Critical/,/^$/{print $0}' file.txt</description>
      <pubDate>Fri, 02 Apr 2004 06:52:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237969#M173174</guid>
      <dc:creator>piotr wienckiewicz</dc:creator>
      <dc:date>2004-04-02T06:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237970#M173175</link>
      <description>Thanks guys... some great tips there...&lt;BR /&gt;&lt;BR /&gt;However.. the file is not as clean as I have made it appear above.  It also has a lot of unwanted Junk in there, but I am only interested in the messages which appear above out of it.  They are all indented in the file, eg:-&lt;BR /&gt;&lt;BR /&gt;blah, blah, blah, blah........&lt;BR /&gt;&lt;BR /&gt;         SEVERITY Critical (Needed)&lt;BR /&gt;         Line 1 (Needed)&lt;BR /&gt;         Line 2 (Needed)&lt;BR /&gt;         Line 3 (Needed)&lt;BR /&gt;         Line 4 (Needed)&lt;BR /&gt;&lt;BR /&gt;blah, blah, blah, blah, &lt;BR /&gt;blah, blah, blah, blah&lt;BR /&gt;&lt;BR /&gt;.. u get this idea.. so I am sorry for not clarifying this initially!  If anyone wants me to send them the file (4mb) or attach it here (Can I do that with 4mb!?) I will do so... &lt;BR /&gt;&lt;BR /&gt;Many thanks again&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Apr 2004 08:26:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237970#M173175</guid>
      <dc:creator>Donnie Darko_1</dc:creator>
      <dc:date>2004-04-02T08:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Please help.. a clever script needed to...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237971#M173176</link>
      <description>Let's assume your file contains blocks of messages and the first line determines if the block must be printed or not.&lt;BR /&gt;&lt;BR /&gt;Take Elmar's solution, and modify it:&lt;BR /&gt;awk '&lt;BR /&gt;/SEVERITY/ &amp;amp;&amp;amp;  /Critical/ { crit=1 }&lt;BR /&gt;/SEVERITY/ &amp;amp;&amp;amp; !/Critical/ { crit=0 }&lt;BR /&gt;crit==1 { print }&lt;BR /&gt;' &lt;FILE&gt;&lt;/FILE&gt;</description>
      <pubDate>Fri, 02 Apr 2004 10:20:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help-a-clever-script-needed-to/m-p/3237971#M173176</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-04-02T10:20:37Z</dc:date>
    </item>
  </channel>
</rss>

