<?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: Reading from file or variable and extract in between information in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130776#M93128</link>
    <description>&amp;gt;but what does this line mean?&lt;BR /&gt;TMP=/var/tmp/ae.$$&lt;BR /&gt;&amp;gt;is it a path?&lt;BR /&gt;&lt;BR /&gt;It is a fairly unique temporary file, based on the PID, to keep the extracted info.</description>
    <pubDate>Thu, 17 Jan 2008 09:05:50 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-01-17T09:05:50Z</dc:date>
    <item>
      <title>Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130773#M93125</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I need help to in extraction. I have a sed command which filters particular lines I want. &lt;BR /&gt;&lt;BR /&gt;This is then stored into a variable. Or if can be pumped into another file, depending on how best the script is written.&lt;BR /&gt;&lt;BR /&gt;If pumped into a file, below is the output:&lt;BR /&gt;&lt;BR /&gt;Severity............: INFORMATION&lt;BR /&gt;Summary:&lt;BR /&gt;     Adapter at hardware path 0/4/1/0/4/0 : CISS: RAID SA controller is now&lt;BR /&gt;     online. &lt;BR /&gt;Severity............: INFORMATION&lt;BR /&gt;Summary:&lt;BR /&gt;     Adapter at hardware path 0/4/1/0/4/0 : CISS: RAID SA controller is now&lt;BR /&gt;     online. &lt;BR /&gt;Severity............: INFORMATION&lt;BR /&gt;Summary:&lt;BR /&gt;     Adapter at hardware path 0/4/1/0/4/0 : CISS: RAID SA controller is now&lt;BR /&gt;     online. &lt;BR /&gt;&lt;BR /&gt;If in a variable, it will be in one line.&lt;BR /&gt;&lt;BR /&gt;Basically, what I need to do is read the file/variable and extract and trigger an opcmsg command if it matches "Severity......: Critical" and printing the relevant Summary information with it.&lt;BR /&gt;&lt;BR /&gt;"Severity............: INFORMATION&lt;BR /&gt;Summary:&lt;BR /&gt;     Adapter at hardware path 0/4/1/0/4/0 : CISS: RAID SA controller is now&lt;BR /&gt;     online." &lt;BR /&gt;&lt;BR /&gt;Hope you can help me.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;Amy&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jan 2008 04:04:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130773#M93125</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-17T04:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130774#M93126</link>
      <description>&lt;!-- !*# --&gt;&lt;P&gt;If you have a file with Severity, Summary and one additional line, then you can do:&lt;BR /&gt;TMP=/var/tmp/ae.$$&lt;BR /&gt;awk '&lt;BR /&gt;/^Severity.*Critical/ {&lt;BR /&gt;print $0&lt;BR /&gt;getline&lt;BR /&gt;print $0&lt;BR /&gt;getline&lt;BR /&gt;print $0&lt;BR /&gt;} ' file &amp;gt; $TMP.2&lt;BR /&gt;&lt;BR /&gt;if [ -s $TMP.2 ]; then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo opcmsg&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cat $TMP.2&lt;BR /&gt;fi&lt;BR /&gt;rm -f $TMP.2&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2011 23:39:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130774#M93126</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-17T23:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130775#M93127</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;Please forgive my noobness, but what does this line mean?&lt;BR /&gt;&lt;BR /&gt;TMP=/var/tmp/ae.$$&lt;BR /&gt;&lt;BR /&gt;is it a path? or part of the awk statement? does the path depend on the path of my file?</description>
      <pubDate>Thu, 17 Jan 2008 08:45:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130775#M93127</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-17T08:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130776#M93128</link>
      <description>&amp;gt;but what does this line mean?&lt;BR /&gt;TMP=/var/tmp/ae.$$&lt;BR /&gt;&amp;gt;is it a path?&lt;BR /&gt;&lt;BR /&gt;It is a fairly unique temporary file, based on the PID, to keep the extracted info.</description>
      <pubDate>Thu, 17 Jan 2008 09:05:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130776#M93128</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-17T09:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130777#M93129</link>
      <description>I see&lt;BR /&gt;&lt;BR /&gt;I ran your script. The cat $TMP.2 output shows 3 entries of &lt;BR /&gt;"Severity............: INFORMATION&lt;BR /&gt;Summary:&lt;BR /&gt;Adapter at hardware path 0/4/1/0/4/0 : CISS: RAID SA controller is now&lt;BR /&gt;online." &lt;BR /&gt;&lt;BR /&gt;How can I make it to read each entry as one opcmsg? &lt;BR /&gt;&lt;BR /&gt;Seeing from the cat output, looks like it will trigger one opcmsg with 3 entries.&lt;BR /&gt;&lt;BR /&gt;amy</description>
      <pubDate>Thu, 17 Jan 2008 09:25:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130777#M93129</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-17T09:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130778#M93130</link>
      <description>&amp;gt;How can I make it to read each entry as one opcmsg?  Seeing from the cat output, looks like it will trigger one opcmsg with 3 entries.&lt;BR /&gt;&lt;BR /&gt;No clue what a "opcmsg" is.  What does it take?  A string or a file or what?&lt;BR /&gt;&lt;BR /&gt;If you want to jam them together you can do:&lt;BR /&gt;$(&amp;lt; $TMP.2 )</description>
      <pubDate>Thu, 17 Jan 2008 11:52:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130778#M93130</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-17T11:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130779#M93131</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;opcmsg is a command to trigger an event alert in Openview Operations for Windows (OVOW) console. OVOW is a fault and performance monitoring application.&lt;BR /&gt;&lt;BR /&gt;I would like the script to read the file (till EOF), detect EACH occurance of the specified pattern ("Severity............: INFORMATION&lt;BR /&gt;Summary:&lt;BR /&gt;Adapter at hardware path 0/4/1/0/4/0 : CISS: RAID SA controller is now&lt;BR /&gt;online."), and trigger the opcmsg command.&lt;BR /&gt;&lt;BR /&gt;hth explains more..:)&lt;BR /&gt;&lt;BR /&gt;Amy&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jan 2008 02:06:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130779#M93131</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-18T02:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130780#M93132</link>
      <description>&amp;gt;opcmsg is a command to trigger an event alert&lt;BR /&gt;&lt;BR /&gt;This is useless, you didn't answer:&lt;BR /&gt;What does it take? A string or a file or what?&lt;BR /&gt;&lt;BR /&gt;Is it?&lt;BR /&gt;opcmsg severity=warning a=a o=o msg_text="test" msg_grp="test"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;EACH occurance of the specified pattern ("Severity............: INFORMATION&lt;BR /&gt;Summary:&lt;BR /&gt;&lt;BR /&gt;You originally said, "Critical" and now you said "INFORMATION", which is it?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;trigger the opcmsg command.&lt;BR /&gt;&lt;BR /&gt;So you want to do more than once?</description>
      <pubDate>Fri, 18 Jan 2008 02:19:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130780#M93132</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-18T02:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130781#M93133</link>
      <description>Yes, those are the parameters for opcmsg.&lt;BR /&gt;&lt;BR /&gt;opcmsg severity=warning a=a o=o msg_text="test" msg_grp="test"&lt;BR /&gt;&lt;BR /&gt;Occurance pattern would be "Critical". &lt;BR /&gt;&lt;BR /&gt;Yes, if there are a few "Critical" occurances, it should trigger a opcmsg command for each time it finds the pattern.&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jan 2008 02:52:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130781#M93133</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-18T02:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Reading from file or variable and extract in between information</title>
      <link>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130782#M93134</link>
      <description>&lt;!--!*#--&gt;Ok, this script has awk calling the system command to invoke opcmsg.  I'm not sure what you want to do with severity=, a=, o= or msg_grp=.  I've removed the Severity line and "Summary:".&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;/^Severity.*Critical/ {&lt;BR /&gt;getline  # skip "Summary:"&lt;BR /&gt;getline&lt;BR /&gt;system("echo opcmsg severity=warning a=a o=o msg_text=\""&lt;BR /&gt;        $0 "\" msg_grp=\"test\"")&lt;BR /&gt;} ' file</description>
      <pubDate>Fri, 18 Jan 2008 03:36:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/reading-from-file-or-variable-and-extract-in-between-information/m-p/4130782#M93134</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-18T03:36:57Z</dc:date>
    </item>
  </channel>
</rss>

