<?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: Help with Grep in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493744#M804804</link>
    <description>If the word you are looking for is surrounded by a space, or any other character (: ; etc..) then you can do a:  grep " exam " filename &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 14 Feb 2001 19:56:06 GMT</pubDate>
    <dc:creator>Patrick Wallek</dc:creator>
    <dc:date>2001-02-14T19:56:06Z</dc:date>
    <item>
      <title>Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493743#M804803</link>
      <description>Here is the problem.&lt;BR /&gt;&lt;BR /&gt;I am doing a grep on a file. I only want lines where the search string is matched exactly.&lt;BR /&gt;&lt;BR /&gt;command % grep exam filename&lt;BR /&gt;&lt;BR /&gt;filename contents:&lt;BR /&gt;line 1)here:is:my:exam:contents&lt;BR /&gt;line 2)here:is:yourproblem:example&lt;BR /&gt;&lt;BR /&gt;The problem is that grep will return both lines because it matches all or part of the search string. Lines that conatina both "exam" and "example" are returned. I only want line 1 to be returned, an exact match. I have looked thru the man pages and I don't see any options that will work. I know it can be done. I am also looking into awk. Any ideas???? &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Feb 2001 19:51:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493743#M804803</guid>
      <dc:creator>Ted Flanders</dc:creator>
      <dc:date>2001-02-14T19:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493744#M804804</link>
      <description>If the word you are looking for is surrounded by a space, or any other character (: ; etc..) then you can do a:  grep " exam " filename &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 14 Feb 2001 19:56:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493744#M804804</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-02-14T19:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493745#M804805</link>
      <description>I realized after I hut submit that I probably didn't explain that well.  In the grep command put the exact string you are looking for, like " exam " where exam is surrounded by a space, or ":exam:" where exam has a : on either side of it.  That should work for you.</description>
      <pubDate>Wed, 14 Feb 2001 19:58:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493745#M804805</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-02-14T19:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493746#M804806</link>
      <description>There is an option to grep that will give you only the exact match of the string you enter. &lt;BR /&gt;&lt;BR /&gt;Check the man page for grep.&lt;BR /&gt;The -x option returns only exact matches.&lt;BR /&gt;&lt;BR /&gt;Tony</description>
      <pubDate>Wed, 14 Feb 2001 20:28:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493746#M804806</guid>
      <dc:creator>Tony Vilardi</dc:creator>
      <dc:date>2001-02-14T20:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493747#M804807</link>
      <description>Check out the -x option to grep. This option is for exact matches</description>
      <pubDate>Wed, 14 Feb 2001 20:30:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493747#M804807</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2001-02-14T20:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493748#M804808</link>
      <description>I will assign points as soon as it lets me....thanks!!!</description>
      <pubDate>Wed, 14 Feb 2001 21:22:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493748#M804808</guid>
      <dc:creator>Ted Flanders</dc:creator>
      <dc:date>2001-02-14T21:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493749#M804809</link>
      <description>I think awk might be better for you.&lt;BR /&gt;&lt;BR /&gt;awk -F: '$3="exam"{print $0}' &lt;MYFILE&gt;&lt;/MYFILE&gt;&lt;BR /&gt;It is more cryptic looking, but if you are planning on doing look ups in a script and need exact matches on a field within a file, then awk gives you more control.&lt;BR /&gt;&lt;BR /&gt;By the way, the -x option of grep looks for exact matches across the entire line.&lt;BR /&gt;&lt;BR /&gt;If you are planning on doing some really tricky stuff with the file, then "perl" has much better text file processing.</description>
      <pubDate>Wed, 14 Feb 2001 23:03:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493749#M804809</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2001-02-14T23:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Grep</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493750#M804810</link>
      <description>Hi Ted,&lt;BR /&gt;&lt;BR /&gt;You'll have to use grep with a character class like in:&lt;BR /&gt;&lt;BR /&gt;grep -E "[^[:alpha:]]exam[^[:alpha:]]"&lt;BR /&gt;&lt;BR /&gt;This will match the string "exam" providing it is surrounded by non alpha characters.&lt;BR /&gt;&lt;BR /&gt;If you want to match your string in cases where it is either starting or ending the line, then the expression becomes:&lt;BR /&gt;&lt;BR /&gt;grep -E "[^[:alpha:]]exam[^[:alpha:]]|^exam[^[:alpha:]]|[^[:alpha:]]exam$"&lt;BR /&gt;&lt;BR /&gt;Becomes to be unreadable, doesn't it ?   &lt;BR /&gt;&lt;BR /&gt;;-)&lt;BR /&gt;&lt;BR /&gt;See man regexp for definitions of character classes.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Feb 2001 09:15:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-grep/m-p/2493750#M804810</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-02-15T09:15:23Z</dc:date>
    </item>
  </channel>
</rss>

