<?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: grep - searching exact pattern in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967725#M95422</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;If you feel that this issue is resolved go-ahead and assign points for the people who have helped you that is a nice way to show gratitude for the people who helped you. You have assigned points only to  3  of   40  responses.&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;&lt;BR /&gt;HGN</description>
    <pubDate>Mon, 26 Mar 2007 13:20:10 GMT</pubDate>
    <dc:creator>HGN</dc:creator>
    <dc:date>2007-03-26T13:20:10Z</dc:date>
    <item>
      <title>grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967716#M95413</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;Could anyone help me to search exact pattern using command "grep". -w option is not available on hp-ux 11.00. Also \&lt;PATTERN&gt; ,is not working .&lt;BR /&gt;&lt;BR /&gt;Could someone please help me on this.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Anil&lt;/PATTERN&gt;</description>
      <pubDate>Fri, 23 Mar 2007 05:27:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967716#M95413</guid>
      <dc:creator>Anil</dc:creator>
      <dc:date>2007-03-23T05:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967717#M95414</link>
      <description>grep -F or fgrep is your friend&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 23 Mar 2007 05:30:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967717#M95414</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2007-03-23T05:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967718#M95415</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;what about grep -e ....&lt;BR /&gt;&lt;BR /&gt;An alternative would be perl or awk.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 23 Mar 2007 05:32:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967718#M95415</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2007-03-23T05:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967719#M95416</link>
      <description>&amp;gt;search exact pattern using command "grep".&lt;BR /&gt;&lt;BR /&gt;You want to search for "words"?&lt;BR /&gt;The poor man's replacement for grep -w is:&lt;BR /&gt;$ grep -e "[[:space:][:punct:]]word[[:space:][:punct:]]"&lt;BR /&gt;&lt;BR /&gt;This may not work for beginning and ending of lines so you may have to add:&lt;BR /&gt;-e "^word[[:space:][:punct:]]" -e "[[:space:][:punct:]]word$"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;\&lt;PATTERN&gt;, is not working&lt;BR /&gt;&lt;BR /&gt;This only works for vi and ex(1).&lt;/PATTERN&gt;</description>
      <pubDate>Fri, 23 Mar 2007 05:40:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967719#M95416</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-23T05:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967720#M95417</link>
      <description>Or even much better: install GNU grep. That does support -w&lt;BR /&gt;&lt;BR /&gt;I have a precompiled version on my site:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.cmve.net/~mbrand/greps-pa2.0.tbz" target="_blank"&gt;http://www.cmve.net/~mbrand/greps-pa2.0.tbz&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Contains GNU grep-2.5.1 (with PCRE support), agrep, and pcregrep 6.4&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 23 Mar 2007 05:53:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967720#M95417</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2007-03-23T05:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967721#M95418</link>
      <description>Hi Anil, &lt;BR /&gt;&lt;BR /&gt;You can try: &lt;BR /&gt;grep -x&lt;BR /&gt;&lt;BR /&gt;-x (eXact) Matches are recognized only when the entire input line matches the fixed string or regular expression.&lt;BR /&gt;&lt;BR /&gt;I'm using it on HP-UX 11i&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Vadim</description>
      <pubDate>Fri, 23 Mar 2007 07:19:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967721#M95418</guid>
      <dc:creator>Vadim Loginov</dc:creator>
      <dc:date>2007-03-23T07:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967722#M95419</link>
      <description>thanks for the immediate response.&lt;BR /&gt;&lt;BR /&gt;I have tried options -F, -x , still doesn't solve my issue. Since my server is in Production, its difficult to install the grep utility.&lt;BR /&gt;&lt;BR /&gt;my requirement is to search pattern "exit"(exactly the same, should not be "#exit") in a file. It can be at any position in the file.&lt;BR /&gt;&lt;BR /&gt;Please guide me..&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Mar 2007 09:08:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967722#M95419</guid>
      <dc:creator>Anil</dc:creator>
      <dc:date>2007-03-26T09:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967723#M95420</link>
      <description>Hi Anil:&lt;BR /&gt;&lt;BR /&gt;If you want to use 'grep' then Dennis's approach will being you the closest to your needs.&lt;BR /&gt;&lt;BR /&gt;However, you need to _define_ what you mean by a "word".  Perl offers one easy way to do this.  For example to find the token "localhost" in '/etc/hosts' without regard to case and bracketed by non-word characters (including line endings or beginnings):&lt;BR /&gt;&lt;BR /&gt;# perl -nle 'print if /\blocalhost\b/i' /etc/hosts&lt;BR /&gt;&lt;BR /&gt;If you want case-sensitivity, drop the "i" from the pattern to match.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Mar 2007 09:39:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967723#M95420</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-26T09:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967724#M95421</link>
      <description>And you do not have to 'install' grep.&lt;BR /&gt;Just put it in your own $HOME/bin or so.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 26 Mar 2007 10:21:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967724#M95421</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2007-03-26T10:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967725#M95422</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;If you feel that this issue is resolved go-ahead and assign points for the people who have helped you that is a nice way to show gratitude for the people who helped you. You have assigned points only to  3  of   40  responses.&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;&lt;BR /&gt;HGN</description>
      <pubDate>Mon, 26 Mar 2007 13:20:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967725#M95422</guid>
      <dc:creator>HGN</dc:creator>
      <dc:date>2007-03-26T13:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967726#M95423</link>
      <description>&amp;gt;my requirement is to search pattern "exit"(exactly the same, should not be "#exit") in a file.&lt;BR /&gt;&lt;BR /&gt;Mine would select #exit since I'm only looking for "words".  You can always pipe my output into grep -v and remove "#exit" and all other false positives until you get closer to what you want.&lt;BR /&gt;&lt;BR /&gt;grep -w also finds "#exit".</description>
      <pubDate>Mon, 26 Mar 2007 19:50:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967726#M95423</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-26T19:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967727#M95424</link>
      <description>The "grep" command uses regular expressions. Unless you specifically say otherwise, regular expressions always assume that there may be any amount of text before or after the pattern. All tools that use regular expressions behave like this.&lt;BR /&gt;&lt;BR /&gt;grep 'exit' /some/file&lt;BR /&gt;&lt;BR /&gt;looks for the four letter string "exit" and displays all the lines where it appears anywhere on the line. In effect, it's the same as:&lt;BR /&gt;grep '.*exit.*' /some/file&lt;BR /&gt;&lt;BR /&gt;If you want to restrict the matching to something that is on the beginning of line, you must anchor the beginning of the match, like this:&lt;BR /&gt;&lt;BR /&gt;grep '^exit' /some/file&lt;BR /&gt;&lt;BR /&gt;'^' means "beginning of line".&lt;BR /&gt;&lt;BR /&gt;If you want to match something at the end of line, there is a different anchor for that:&lt;BR /&gt;&lt;BR /&gt;grep 'exit$' /some/file&lt;BR /&gt;&lt;BR /&gt;If you want to match when your pattern covers the entire line (i.e. the matching text is the only thing on the line), use both anchors together:&lt;BR /&gt;&lt;BR /&gt;grep '^exit$' /some/file&lt;BR /&gt;&lt;BR /&gt;This searches for lines that have *only* the word "exit" and nothing else.&lt;BR /&gt;&lt;BR /&gt;Note that I'm using single quotes around the pattern: this way there will be no problems with special characters like "$".&lt;BR /&gt; &lt;BR /&gt;If you need to use environment variables within your pattern string, you should use double quotes instead. Then you may need to replace the end-of-line anchor "$" with "\$" so the shell does not think you're specifying a variable name.</description>
      <pubDate>Tue, 27 Mar 2007 00:25:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967727#M95424</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2007-03-27T00:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967728#M95425</link>
      <description>&amp;gt;Matti: Then you may need to replace the end-of-line anchor "$" with "\$" so the shell does not think you're specifying a variable name.&lt;BR /&gt;&lt;BR /&gt;Note: This isn't needed if you are using a real shell.  This is only needed if you are using the scummy C shell.</description>
      <pubDate>Tue, 27 Mar 2007 00:45:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967728#M95425</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-27T00:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967729#M95426</link>
      <description>Hi Anil,&lt;BR /&gt;&lt;BR /&gt;Try this&lt;BR /&gt;&lt;BR /&gt;grep -F -x exit filename&lt;BR /&gt;&lt;BR /&gt;will exactly match the string "exit" from the filename.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.&lt;BR /&gt;</description>
      <pubDate>Sun, 01 Apr 2007 04:13:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967729#M95426</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-04-01T04:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: grep - searching exact pattern</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967730#M95427</link>
      <description>Oops!!&lt;BR /&gt;&lt;BR /&gt;I did not test with the multiword lines. It is only applicable to single word lines as already mentioned.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.</description>
      <pubDate>Sun, 01 Apr 2007 04:50:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-searching-exact-pattern/m-p/3967730#M95427</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-04-01T04:50:20Z</dc:date>
    </item>
  </channel>
</rss>

