<?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 question on grep command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670402#M723041</link>
    <description>I am working on HP-UX&lt;BR /&gt;I have a file as follows&lt;BR /&gt;Record 1&lt;BR /&gt;--------&lt;BR /&gt;Name:&lt;BR /&gt;address:&lt;BR /&gt;Phone:&lt;BR /&gt;Phone:&lt;BR /&gt;Record 2&lt;BR /&gt;--------&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;From the above in shell programming How do i grep for the first occurance of the string "phone:". Any body can help&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Narasimham&lt;BR /&gt;</description>
    <pubDate>Fri, 22 Feb 2002 22:02:25 GMT</pubDate>
    <dc:creator>Narasimham</dc:creator>
    <dc:date>2002-02-22T22:02:25Z</dc:date>
    <item>
      <title>question on grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670402#M723041</link>
      <description>I am working on HP-UX&lt;BR /&gt;I have a file as follows&lt;BR /&gt;Record 1&lt;BR /&gt;--------&lt;BR /&gt;Name:&lt;BR /&gt;address:&lt;BR /&gt;Phone:&lt;BR /&gt;Phone:&lt;BR /&gt;Record 2&lt;BR /&gt;--------&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;From the above in shell programming How do i grep for the first occurance of the string "phone:". Any body can help&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Narasimham&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Feb 2002 22:02:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670402#M723041</guid>
      <dc:creator>Narasimham</dc:creator>
      <dc:date>2002-02-22T22:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: question on grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670403#M723042</link>
      <description>Hi Narasimham,&lt;BR /&gt;&lt;BR /&gt;If you only want the first occurance of "phone:" do:&lt;BR /&gt;&lt;BR /&gt;grep "phone:" file | head -1&lt;BR /&gt;&lt;BR /&gt;If "phone:" must be at the beginning of the line use "^phone:".&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Fri, 22 Feb 2002 22:05:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670403#M723042</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2002-02-22T22:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: question on grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670404#M723043</link>
      <description>This is a little bit more complicated if what you really want, is the first 'Phone:' after each 'Name:'. If that is the case, then a little bit of Perl or Awk will be your best bet. Is this what you are really trying to do?&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Fri, 22 Feb 2002 22:12:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670404#M723043</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-22T22:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: question on grep command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670405#M723044</link>
      <description>1. With grep, you can also add '-i' for case-insensative searches Phone vs phone&lt;BR /&gt;&lt;BR /&gt;2. To get the first Phone: from each /Record:/&lt;BR /&gt;&lt;BR /&gt;perl -ne '/^Record\s+(\d+)/ and $rn=$1,next;$rn&amp;amp;&amp;amp;/^Phone/i or next;print;$rn=0;' datafile</description>
      <pubDate>Wed, 27 Feb 2002 10:10:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-on-grep-command/m-p/2670405#M723044</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-02-27T10:10:42Z</dc:date>
    </item>
  </channel>
</rss>

