<?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: Find a sentence, skip 5 lines, read lines 6-8 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087742#M93116</link>
    <description>Oops, that list line should be:&lt;BR /&gt;END { print "Restart after line", save_NR }</description>
    <pubDate>Mon, 14 Jan 2008 09:05:37 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-01-14T09:05:37Z</dc:date>
    <item>
      <title>Find a sentence, skip 5 lines, read lines 6-8</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087740#M93114</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I have a scenario where a shell script is required to grep and match phrase from a logfile, then skip the next few lines then grep the next subsequent lines. &lt;BR /&gt;&lt;BR /&gt;And I have to display the first grep phrase plus the next subsequent lines.&lt;BR /&gt;&lt;BR /&gt;For example: I want to grep if "Severity............: INFORMATION" exist, then grep from "Summary..." onwards (which is in 2-4 lines depending on the details in Summary.&lt;BR /&gt;&lt;BR /&gt;Results hoped for:&lt;BR /&gt;"Serverity............: INFORMATION. Summary: Adapter at hardware path 0/4/1/0/4/0 : CISS: RAID SA controller is now online."&lt;BR /&gt;&lt;BR /&gt;Some challenges:&lt;BR /&gt;1. The logfile gets appended- How can the script tell when it read the logfile last?&lt;BR /&gt;&lt;BR /&gt;Event data from monitor:&lt;BR /&gt;&lt;BR /&gt;Event Time..........: Thu Mar 30 11:29:50 2006&lt;BR /&gt;Severity............: INFORMATION&lt;BR /&gt;Monitor.............: dm_raid_adapter&lt;BR /&gt;Event #.............: 2                   &lt;BR /&gt;System..............: SERVER_NAME&lt;BR /&gt;&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 some of you gurus can help me.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;Amy</description>
      <pubDate>Mon, 14 Jan 2008 04:03:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087740#M93114</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-14T04:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Find a sentence, skip 5 lines, read lines 6-8</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087741#M93115</link>
      <description>&lt;!--!*#--&gt;&amp;gt;grep and match phrase from a logfile, then skip the next few lines then grep the next subsequent lines.&lt;BR /&gt;&lt;BR /&gt;What happens if there is more than one occurrence?  Did you want to do it only once?  Or all occurrences?&lt;BR /&gt;&lt;BR /&gt;You could try:&lt;BR /&gt;awk -v START=$number '&lt;BR /&gt;/Severity............: INFORMATION/ {&lt;BR /&gt;if (NR &amp;lt;= START) next # already done&lt;BR /&gt;save_NR = NR&lt;BR /&gt;save = $0&lt;BR /&gt;getline; getline; getline; getline; getline&lt;BR /&gt;save2 = $0&lt;BR /&gt;getline&lt;BR /&gt;save3 = $0&lt;BR /&gt;getline&lt;BR /&gt;save4 = $0&lt;BR /&gt;print save, save2, save3, save4&lt;BR /&gt;}&lt;BR /&gt;END { print "Restart after line, save_NR" }&lt;BR /&gt;' file&lt;BR /&gt;&lt;BR /&gt;Issues:  Not sure how many lines in Summary to print?&lt;BR /&gt;You have to take the output of the "Restart after" to feed it back as $number.</description>
      <pubDate>Mon, 14 Jan 2008 09:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087741#M93115</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-14T09:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Find a sentence, skip 5 lines, read lines 6-8</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087742#M93116</link>
      <description>Oops, that list line should be:&lt;BR /&gt;END { print "Restart after line", save_NR }</description>
      <pubDate>Mon, 14 Jan 2008 09:05:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087742#M93116</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-14T09:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Find a sentence, skip 5 lines, read lines 6-8</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087743#M93117</link>
      <description>Thanks for the suggestion.&lt;BR /&gt;&lt;BR /&gt;I have managed to write another script. Thanks</description>
      <pubDate>Mon, 14 Jan 2008 10:45:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087743#M93117</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-14T10:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Find a sentence, skip 5 lines, read lines 6-8</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087744#M93118</link>
      <description>Dennis spent some time coming up with a solution. Sending a couple points his way is a nice way to say thank-you...&lt;BR /&gt;&lt;BR /&gt;my 2 cents&lt;BR /&gt;&lt;BR /&gt;Rod Hills</description>
      <pubDate>Mon, 14 Jan 2008 15:59:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087744#M93118</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2008-01-14T15:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find a sentence, skip 5 lines, read lines 6-8</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087745#M93119</link>
      <description>Thanks for you suggestions!..:)</description>
      <pubDate>Tue, 15 Jan 2008 01:44:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087745#M93119</guid>
      <dc:creator>amykoh</dc:creator>
      <dc:date>2008-01-15T01:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Find a sentence, skip 5 lines, read lines 6-8</title>
      <link>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087746#M93120</link>
      <description>What Rod was suggesting was that you assign points as a way of a thank you.  See the following link:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;</description>
      <pubDate>Thu, 17 Jan 2008 07:57:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/find-a-sentence-skip-5-lines-read-lines-6-8/m-p/5087746#M93120</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-17T07:57:09Z</dc:date>
    </item>
  </channel>
</rss>

