<?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: Script Help ? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460730#M679995</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;# awk '/^===/ {PREV=$0};{if (/error/) {print PREV;print}}' file&lt;BR /&gt;&lt;BR /&gt;You may need to change the trigger "error" to something else.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 15 Jul 2009 22:15:30 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-07-15T22:15:30Z</dc:date>
    <item>
      <title>Script Help ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460729#M679994</link>
      <description>&lt;BR /&gt;I created a  log search script which ssh's to other host log files and finds out errors. Here is a snippet where it cannot find the errors - &lt;BR /&gt;&lt;BR /&gt;#./logsearch.sh &lt;DATE&gt; "error-text"&lt;BR /&gt;================= cluster 1 host1 ===============&lt;BR /&gt;================= cluster 1 host2 =================&lt;BR /&gt;================= cluster 2 host3 =================&lt;BR /&gt;================= cluster 2 host4 =================&lt;BR /&gt;&lt;BR /&gt;Here is a snippet of where it does find errors  - &lt;BR /&gt;&lt;BR /&gt;================= cluster 1 host1 =================&lt;BR /&gt;================= cluster 1 host2 =================&lt;BR /&gt;specific-errors&lt;BR /&gt;specific-errors&lt;BR /&gt;....&lt;BR /&gt;================= cluster 2 host3 =================&lt;BR /&gt;================= cluster 2 host4 =================&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I want to create a script which identifies which cluster-host combination has those specific error and then page out to the team with that information specifying cluster-host(which has the errors) in that page.&lt;BR /&gt;How do I parse the cluster-host combination which has issues from this output is my question through bash.&lt;/DATE&gt;</description>
      <pubDate>Wed, 15 Jul 2009 21:38:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460729#M679994</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-07-15T21:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460730#M679995</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;# awk '/^===/ {PREV=$0};{if (/error/) {print PREV;print}}' file&lt;BR /&gt;&lt;BR /&gt;You may need to change the trigger "error" to something else.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 15 Jul 2009 22:15:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460730#M679995</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-15T22:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460731#M679996</link>
      <description>Hi (again) Allanm:&lt;BR /&gt;&lt;BR /&gt;This variation yields cleaner output:&lt;BR /&gt;&lt;BR /&gt;# awk '/^===/ {PREV=$0};{if (/error/) {if (PREV) {print PREV;PREV="";print} else {print}}}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Jul 2009 22:56:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460731#M679996</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-15T22:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460732#M679997</link>
      <description>Thanks JRF!&lt;BR /&gt;&lt;BR /&gt;The following actually worked for me - &lt;BR /&gt;&lt;BR /&gt;awk '/^===/ {PREV=$0};{if (/error/) {print PREV}}' log&lt;BR /&gt;&lt;BR /&gt;If  you can explain a little more abt it as well that will be great.&lt;BR /&gt;&lt;BR /&gt;Allan.</description>
      <pubDate>Wed, 15 Jul 2009 23:25:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460732#M679997</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2009-07-15T23:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460733#M679998</link>
      <description>Hi (again) Allanm:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; # awk '/^===/ {PREV=$0};{if (/error/) {print PREV;print}}'&lt;BR /&gt;&lt;BR /&gt;&amp;gt; If you can explain a little more abt it as well that will be great.&lt;BR /&gt;&lt;BR /&gt;As each line from your file is read, a test is made to see if the line begins (^) with the characters '==='.  If if does, the statement in braces is executed.  That is, the whole line ($0) is captured in the 'PREV' variable.  A test is then made for lines with the sequence of 'error'.  If that test is true, then the 'PREV' variable contents is printed followed by the line just read.  In 'awk', a 'print' without any object is a print of the current line (which can also be explicitly written as '$0').&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 15 Jul 2009 23:57:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/4460733#M679998</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-15T23:57:29Z</dc:date>
    </item>
  </channel>
</rss>

