<?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: extracting specific line from text in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897395#M841391</link>
    <description>Hi Henry,&lt;BR /&gt;&lt;BR /&gt;To list lines 2  through 8 of a file&lt;BR /&gt;&lt;BR /&gt;In awk  ----&amp;gt; awk 'NR&amp;gt;=2 &amp;amp;&amp;amp; NR &amp;lt;=8' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;In sed  ----&amp;gt; sed -n -e  2,8p filename &lt;BR /&gt;&lt;BR /&gt;In perl ----&amp;gt; perl -ne 'print unless (($.&amp;lt;2) or ($.&amp;gt;8));' filename &lt;BR /&gt;&lt;BR /&gt;In your case to extract line 2&lt;BR /&gt;&lt;BR /&gt;sed -n -e 2,2p filename &lt;BR /&gt;&lt;BR /&gt;IA&lt;/FILENAME&gt;</description>
    <pubDate>Thu, 21 Apr 2005 02:17:02 GMT</pubDate>
    <dc:creator>Indira Aramandla</dc:creator>
    <dc:date>2005-04-21T02:17:02Z</dc:date>
    <item>
      <title>extracting specific line from text</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897391#M841387</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt; Say I want to extract line 2 from a text log, what is the best way to do it using shell?&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Henry</description>
      <pubDate>Thu, 21 Apr 2005 01:57:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897391#M841387</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2005-04-21T01:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: extracting specific line from text</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897392#M841388</link>
      <description>&lt;BR /&gt;head -2 &lt;FILENAME&gt; | tail -1&lt;/FILENAME&gt;</description>
      <pubDate>Thu, 21 Apr 2005 02:00:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897392#M841388</guid>
      <dc:creator>Alex Lavrov.</dc:creator>
      <dc:date>2005-04-21T02:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: extracting specific line from text</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897393#M841389</link>
      <description>Henry,&lt;BR /&gt;you do not specify the selection criteria for your extract (top of the file,end of the file....)&lt;BR /&gt;&lt;BR /&gt;If you want to extract lines 12 and 13 of a file for example you can use &lt;BR /&gt;sed -n '12,13' file.lis&lt;BR /&gt;&lt;BR /&gt;For top 2 lines:&lt;BR /&gt;head -2 file.lis&lt;BR /&gt;&lt;BR /&gt;For last 2 lines:&lt;BR /&gt;tail -2 file.lis&lt;BR /&gt;&lt;BR /&gt;Can you please update with more details.&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 21 Apr 2005 02:05:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897393#M841389</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-04-21T02:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: extracting specific line from text</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897394#M841390</link>
      <description>Another one I came up with:&lt;BR /&gt;&lt;BR /&gt;cat -n &lt;FILE name=""&gt; | awk '$1 ~ ln {print $0}' ln=&lt;LINE num=""&gt;&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;cat -n /tmp/my_test.txt | awk '$1 ~ ln {print $0}' ln=28&lt;/LINE&gt;&lt;/FILE&gt;</description>
      <pubDate>Thu, 21 Apr 2005 02:10:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897394#M841390</guid>
      <dc:creator>Alex Lavrov.</dc:creator>
      <dc:date>2005-04-21T02:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: extracting specific line from text</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897395#M841391</link>
      <description>Hi Henry,&lt;BR /&gt;&lt;BR /&gt;To list lines 2  through 8 of a file&lt;BR /&gt;&lt;BR /&gt;In awk  ----&amp;gt; awk 'NR&amp;gt;=2 &amp;amp;&amp;amp; NR &amp;lt;=8' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;In sed  ----&amp;gt; sed -n -e  2,8p filename &lt;BR /&gt;&lt;BR /&gt;In perl ----&amp;gt; perl -ne 'print unless (($.&amp;lt;2) or ($.&amp;gt;8));' filename &lt;BR /&gt;&lt;BR /&gt;In your case to extract line 2&lt;BR /&gt;&lt;BR /&gt;sed -n -e 2,2p filename &lt;BR /&gt;&lt;BR /&gt;IA&lt;/FILENAME&gt;</description>
      <pubDate>Thu, 21 Apr 2005 02:17:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897395#M841391</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2005-04-21T02:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: extracting specific line from text</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897396#M841392</link>
      <description>Thanks guys, got the answer I want..&lt;BR /&gt;Alex first solution is brilliant.. short but handy..&lt;BR /&gt;&lt;BR /&gt;THanks!!</description>
      <pubDate>Thu, 21 Apr 2005 02:58:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/extracting-specific-line-from-text/m-p/4897396#M841392</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2005-04-21T02:58:42Z</dc:date>
    </item>
  </channel>
</rss>

