<?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: Sed script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476343#M846760</link>
    <description>Hi Peter,&lt;BR /&gt;It won't work that way. The output will include  some unwanted lines.&lt;BR /&gt;</description>
    <pubDate>Wed, 02 Feb 2005 04:17:44 GMT</pubDate>
    <dc:creator>Aminur Rizal</dc:creator>
    <dc:date>2005-02-02T04:17:44Z</dc:date>
    <item>
      <title>Sed script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476339#M846756</link>
      <description>Hi guys,&lt;BR /&gt;I have been working with this sed but can't get it work properly.&lt;BR /&gt;I have a file - a long one - with data and need to grep the phrases 2 lines after the keyword "var_out" hence :-&lt;BR /&gt;&lt;BR /&gt;USIM=`grep -E -n "var_out" filename.txt | awk '{print $1+2}'`&lt;BR /&gt;This will result in number the line numbers of the data such as :-&lt;BR /&gt;20 43 56  75 88&lt;BR /&gt;&lt;BR /&gt;Later I will use sed to grep all the phrases in  the line numbers obtained from the first script.&lt;BR /&gt;&lt;BR /&gt;sed -n "$USIMp" filename.txt &amp;gt; result.txt&lt;BR /&gt;But it doesn't work.&lt;BR /&gt;Can you please help.&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Feb 2005 23:14:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476339#M846756</guid>
      <dc:creator>Aminur Rizal</dc:creator>
      <dc:date>2005-02-01T23:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sed script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476340#M846757</link>
      <description>sed -n "$USIMp" filename.txt &amp;gt;result.txt&lt;BR /&gt;will look see if a variable named USIMp exists, which we assume doesn't.&lt;BR /&gt; &lt;BR /&gt;Usually you would use curly brackets like-&lt;BR /&gt;sed -n "${USIM}p" filename.txt &amp;gt;result.txt&lt;BR /&gt;so that will evaluate to&lt;BR /&gt;sed -n "20 43 56 75 88p" filename.xt &amp;gt;result.txt&lt;BR /&gt;But this probabily isn't going get what you want.&lt;BR /&gt; &lt;BR /&gt;You could try-&lt;BR /&gt;grep -E -n "var_out" filename.txt | awk '{printf "%dp\n",$1+2}' &amp;gt;/tmp/mylist&lt;BR /&gt;sed -n -f /tmp/mylist filename.txt &amp;gt;result.txt&lt;BR /&gt; &lt;BR /&gt;Or perl can do it-&lt;BR /&gt;perl -n -e '$n=$.+2 if /var_out/; print $_ if  $n == $.' filename.txt &amp;gt;result.txt&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 02 Feb 2005 00:39:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476340#M846757</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2005-02-02T00:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sed script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476341#M846758</link>
      <description>Hi Rodney,&lt;BR /&gt;Great! It really works  for me.&lt;BR /&gt;I will stick with the awk and sed for the time being. Perl is too complex for me :)&lt;BR /&gt;Many thanks for the help.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Feb 2005 02:10:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476341#M846758</guid>
      <dc:creator>Aminur Rizal</dc:creator>
      <dc:date>2005-02-02T02:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sed script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476342#M846759</link>
      <description>Hi,&lt;BR /&gt;if you want to pull out the line following 2 after the key_word "var_out" try:&lt;BR /&gt;&lt;BR /&gt;sed -n '/var_out/n;n;p;' filename.txt&lt;BR /&gt;&lt;BR /&gt;The n;n;p; means next;next;print;&lt;BR /&gt;Is this of any help?&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 02 Feb 2005 03:54:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476342#M846759</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-02-02T03:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sed script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476343#M846760</link>
      <description>Hi Peter,&lt;BR /&gt;It won't work that way. The output will include  some unwanted lines.&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Feb 2005 04:17:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-script/m-p/3476343#M846760</guid>
      <dc:creator>Aminur Rizal</dc:creator>
      <dc:date>2005-02-02T04:17:44Z</dc:date>
    </item>
  </channel>
</rss>

