<?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: Exit after first 'found' in grep in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811926#M84503</link>
    <description>Hi &lt;BR /&gt;&lt;BR /&gt;with awk it's something like this:&lt;BR /&gt;&lt;BR /&gt;awk '/correct/ {print $0;exit}' file&lt;BR /&gt;&lt;BR /&gt;regards &lt;BR /&gt;Christian</description>
    <pubDate>Tue, 24 Sep 2002 05:03:44 GMT</pubDate>
    <dc:creator>Christian Gebhardt</dc:creator>
    <dc:date>2002-09-24T05:03:44Z</dc:date>
    <item>
      <title>Exit after first 'found' in grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811925#M84502</link>
      <description>i have a text file&lt;BR /&gt;_________________________&lt;BR /&gt;syslog file is correct&lt;BR /&gt;i am not correct&lt;BR /&gt;_________________________&lt;BR /&gt;&lt;BR /&gt;if i do&lt;BR /&gt;grep "correct" txt &lt;BR /&gt;it will return both the lines,&lt;BR /&gt;&lt;BR /&gt;How do i exit after the first "correct" is grepped ?&lt;BR /&gt;&lt;BR /&gt;Aravind&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Sep 2002 04:44:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811925#M84502</guid>
      <dc:creator>Aravind_3</dc:creator>
      <dc:date>2002-09-24T04:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Exit after first 'found' in grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811926#M84503</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;with awk it's something like this:&lt;BR /&gt;&lt;BR /&gt;awk '/correct/ {print $0;exit}' file&lt;BR /&gt;&lt;BR /&gt;regards &lt;BR /&gt;Christian</description>
      <pubDate>Tue, 24 Sep 2002 05:03:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811926#M84503</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-09-24T05:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Exit after first 'found' in grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811927#M84504</link>
      <description>if you like grep try this:&lt;BR /&gt;grep correct a | head  -1&lt;BR /&gt;&lt;BR /&gt;Christian</description>
      <pubDate>Tue, 24 Sep 2002 05:29:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811927#M84504</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-09-24T05:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Exit after first 'found' in grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811928#M84505</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;You can also use: &lt;BR /&gt;cat a |grep correct | head -1&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Sep 2002 08:51:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811928#M84505</guid>
      <dc:creator>Elif Gius</dc:creator>
      <dc:date>2002-09-24T08:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Exit after first 'found' in grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811929#M84506</link>
      <description>If you just want to test if the search text is in the file, then you can use the "-q" option.&lt;BR /&gt;&lt;BR /&gt;if grep -q "correct" txt ; then&lt;BR /&gt;echo "correct is in file txt"&lt;BR /&gt;else&lt;BR /&gt;echo "no correct found!"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;"-q" forces grep to stop after the first instance is found.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 24 Sep 2002 13:48:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/exit-after-first-found-in-grep/m-p/2811929#M84506</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-09-24T13:48:43Z</dc:date>
    </item>
  </channel>
</rss>

