<?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 help lines script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-lines-script/m-p/4177119#M90945</link>
    <description>Hi, I have this lines , my patern to find is example: 50:06:04:8c:52:a5:62:88 , I need extract the two previos lines &lt;BR /&gt;include Name hosts &lt;BR /&gt;&lt;BR /&gt;zone:  HOSTB-SRV:8b_1&lt;BR /&gt;                20:00:00:e0:69:41:4c:3f&lt;BR /&gt;                50:06:04:84:49:af:03:a7&lt;BR /&gt; zone:  HOSTA-SRV:9c0&lt;BR /&gt;                20:00:00:e0:69:41:4c:3f&lt;BR /&gt;                50:06:04:8c:52:a5:62:88&lt;BR /&gt;&lt;BR /&gt;awk '/50:06:04:8c:52:a5:62:88/' output.tmp&lt;BR /&gt;50:06:04:8c:52:a5:62:88&lt;BR /&gt;&lt;BR /&gt;grep "50:06:04:8c:52:a5:62:88" output.tmp&lt;BR /&gt;50:06:04:8c:52:a5:62:88</description>
    <pubDate>Wed, 09 Apr 2008 16:09:47 GMT</pubDate>
    <dc:creator>Jairo Campana</dc:creator>
    <dc:date>2008-04-09T16:09:47Z</dc:date>
    <item>
      <title>help lines script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-lines-script/m-p/4177119#M90945</link>
      <description>Hi, I have this lines , my patern to find is example: 50:06:04:8c:52:a5:62:88 , I need extract the two previos lines &lt;BR /&gt;include Name hosts &lt;BR /&gt;&lt;BR /&gt;zone:  HOSTB-SRV:8b_1&lt;BR /&gt;                20:00:00:e0:69:41:4c:3f&lt;BR /&gt;                50:06:04:84:49:af:03:a7&lt;BR /&gt; zone:  HOSTA-SRV:9c0&lt;BR /&gt;                20:00:00:e0:69:41:4c:3f&lt;BR /&gt;                50:06:04:8c:52:a5:62:88&lt;BR /&gt;&lt;BR /&gt;awk '/50:06:04:8c:52:a5:62:88/' output.tmp&lt;BR /&gt;50:06:04:8c:52:a5:62:88&lt;BR /&gt;&lt;BR /&gt;grep "50:06:04:8c:52:a5:62:88" output.tmp&lt;BR /&gt;50:06:04:8c:52:a5:62:88</description>
      <pubDate>Wed, 09 Apr 2008 16:09:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-lines-script/m-p/4177119#M90945</guid>
      <dc:creator>Jairo Campana</dc:creator>
      <dc:date>2008-04-09T16:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: help lines script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-lines-script/m-p/4177120#M90946</link>
      <description>Just have awk stash away the lines as it read them , for example in l2 and l1 and print those on match.&lt;BR /&gt;&lt;BR /&gt;With hard-coded match:&lt;BR /&gt;&lt;BR /&gt;$ awk '/50:06:04:8c:52:a5:62:88/{print l2; print l1} {l2=l1;l1=$0}' x&lt;BR /&gt;zone: HOSTA-SRV:9c0&lt;BR /&gt;20:00:00:e0:69:41:4c:3f&lt;BR /&gt;&lt;BR /&gt;Using a variable to look for...&lt;BR /&gt;&lt;BR /&gt;$ id="50:06:04:8c:52:a5:62:88"&lt;BR /&gt;$ awk -vid=$id '$1==id {print l2; print l1} {l2=l1;l1=$0}' x&lt;BR /&gt;zone: HOSTA-SRV:9c0&lt;BR /&gt;20:00:00:e0:69:41:4c:3f&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Apr 2008 16:43:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-lines-script/m-p/4177120#M90946</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-04-09T16:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: help lines script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-lines-script/m-p/4177121#M90947</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;One way (in Perl):&lt;BR /&gt;&lt;BR /&gt;perl -e '@lines=reverse (&amp;lt;&amp;gt;);for (@lines) {push @rslt,$_ if /^50:06:04:8c/../^zone/};print reverse @rslt' file&lt;BR /&gt;&lt;BR /&gt;zone: HOSTA-SRV:9c0&lt;BR /&gt;20:00:00:e0:69:41:4c:3f&lt;BR /&gt;50:06:04:8c:52:a5:62:88&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 09 Apr 2008 17:20:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-lines-script/m-p/4177121#M90947</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-09T17:20:12Z</dc:date>
    </item>
  </channel>
</rss>

