<?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: The grep pattern? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936143#M929014</link>
    <description>Seeing as how it's a two line file, you could always come at this from the other direction:&lt;BR /&gt;&lt;BR /&gt;grep -v MSC_ID_LIST test.dat&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
    <pubDate>Wed, 26 Mar 2003 13:58:41 GMT</pubDate>
    <dc:creator>Pete Randall</dc:creator>
    <dc:date>2003-03-26T13:58:41Z</dc:date>
    <item>
      <title>The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936135#M929006</link>
      <description>Hi,there&lt;BR /&gt;&lt;BR /&gt;I had a file test.dat which contained two lines as below:&lt;BR /&gt;&lt;BR /&gt;MSC_ID&lt;BR /&gt;MSC_ID_LIST&lt;BR /&gt;&lt;BR /&gt;Then I used  "grep MSC_ID test.dat" just return&lt;BR /&gt;MSC_ID&lt;BR /&gt;MSC_ID_LIST&lt;BR /&gt;&lt;BR /&gt;However I could not get the unique line that included "MSC_ID" only.&lt;BR /&gt;I tried :&lt;BR /&gt;grep "\&lt;MSC_ID&gt;" test.dat&lt;BR /&gt;egrep "\&lt;MSC_ID&gt;" test.dat&lt;BR /&gt;egrep '\&lt;MSC_ID&gt;' test.dat&lt;BR /&gt;&lt;BR /&gt;All failed.How could I catch the "MSC_ID" line only?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Jack&lt;BR /&gt;&lt;BR /&gt;&lt;/MSC_ID&gt;&lt;/MSC_ID&gt;&lt;/MSC_ID&gt;</description>
      <pubDate>Wed, 26 Mar 2003 13:40:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936135#M929006</guid>
      <dc:creator>Jack_27</dc:creator>
      <dc:date>2003-03-26T13:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936136#M929007</link>
      <description>Jack,&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;# grep -x MSC_ID test.dat&lt;BR /&gt;&lt;BR /&gt;Hai</description>
      <pubDate>Wed, 26 Mar 2003 13:46:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936136#M929007</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2003-03-26T13:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936137#M929008</link>
      <description>Hai,&lt;BR /&gt;&lt;BR /&gt;I tried that but also failed.&lt;BR /&gt;&lt;BR /&gt;&lt;MY&gt;$grep -x MSC_ID test.dat&lt;BR /&gt;&lt;MY&gt;$&lt;BR /&gt;&lt;BR /&gt;Jack&lt;BR /&gt;&lt;/MY&gt;&lt;/MY&gt;</description>
      <pubDate>Wed, 26 Mar 2003 13:50:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936137#M929008</guid>
      <dc:creator>Jack_27</dc:creator>
      <dc:date>2003-03-26T13:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936138#M929009</link>
      <description>Hai&lt;BR /&gt;&lt;BR /&gt;Maybe I missed other infor,in fact it is:&lt;BR /&gt;&lt;BR /&gt;MSC_ID 093-234&lt;BR /&gt;MSC_ID_LIST 1157&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Mar 2003 13:52:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936138#M929009</guid>
      <dc:creator>Jack_27</dc:creator>
      <dc:date>2003-03-26T13:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936139#M929010</link>
      <description>the -w switch should do the trick.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;RZ&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Mar 2003 13:52:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936139#M929010</guid>
      <dc:creator>Ross Zubritski</dc:creator>
      <dc:date>2003-03-26T13:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936140#M929011</link>
      <description>If there is nothing else on the line, then you can use the "anchor" characters. A caret (^) anchors to the start of line, and a dollar sign ($) anchors to the end of line. So:&lt;BR /&gt;&lt;BR /&gt;grep "^MSC_ID$" test.dat</description>
      <pubDate>Wed, 26 Mar 2003 13:53:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936140#M929011</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2003-03-26T13:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936141#M929012</link>
      <description>Hi,&lt;BR /&gt;another method is matching at the end of line&lt;BR /&gt;&lt;BR /&gt;grep MSC_ID$ test.dat</description>
      <pubDate>Wed, 26 Mar 2003 13:54:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936141#M929012</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-03-26T13:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936142#M929013</link>
      <description>Re:&lt;BR /&gt;MSC_ID 093-234 &lt;BR /&gt;MSC_ID_LIST 1157&lt;BR /&gt;&lt;BR /&gt;If you want the first, but not the second, then do&lt;BR /&gt;&lt;BR /&gt;grep "MSC_ID " test.dat&lt;BR /&gt;&lt;BR /&gt;i.e. a space after "MSC_ID". That will match "MSC_ID &lt;SOMETHING&gt;", but not "MSC_ID_&lt;SOMETHING&gt;".&lt;/SOMETHING&gt;&lt;/SOMETHING&gt;</description>
      <pubDate>Wed, 26 Mar 2003 13:57:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936142#M929013</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2003-03-26T13:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936143#M929014</link>
      <description>Seeing as how it's a two line file, you could always come at this from the other direction:&lt;BR /&gt;&lt;BR /&gt;grep -v MSC_ID_LIST test.dat&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 26 Mar 2003 13:58:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936143#M929014</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-03-26T13:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936144#M929015</link>
      <description>Thank all people here.&lt;BR /&gt;&lt;BR /&gt;And Frank,it does work as you mentioned,then what could be used when I really want to match a word precisely?&lt;BR /&gt;I checked the manual and they told me that the "\&lt;WORD&gt;" would be fine.&lt;BR /&gt;&lt;BR /&gt;Why the grep "\&lt;WORD&gt;" has no result?&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Jack&lt;/WORD&gt;&lt;/WORD&gt;</description>
      <pubDate>Wed, 26 Mar 2003 14:02:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936144#M929015</guid>
      <dc:creator>Jack_27</dc:creator>
      <dc:date>2003-03-26T14:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936145#M929017</link>
      <description>&amp;gt; Why the grep "\&lt;WORD&gt;" has no result? &lt;BR /&gt;&lt;BR /&gt;Because it is not implemented in your version of HP-UX. I.e. "the manual" you read is probably not a HP-UX manual.&lt;BR /&gt;&lt;BR /&gt;There are many threads on this subject. Please search for "grep -w" and you will probably find them.&lt;BR /&gt;&lt;BR /&gt;&lt;/WORD&gt;</description>
      <pubDate>Wed, 26 Mar 2003 14:11:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936145#M929017</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2003-03-26T14:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936146#M929018</link>
      <description>HP-UX 11i, i.e. 11.11 or higher, has the "-w" (word) option, i.e.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; $ grep -w MSC_ID test.dat&lt;BR /&gt;&amp;gt; MSC_ID 093-234&lt;BR /&gt;&amp;gt; $&lt;BR /&gt;&lt;BR /&gt;I am not aware of any *HP-UX* grep(1) versions which recognize "\&lt;WORD&gt;".&lt;BR /&gt;&lt;/WORD&gt;</description>
      <pubDate>Wed, 26 Mar 2003 14:21:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936146#M929018</guid>
      <dc:creator>Frank Slootweg</dc:creator>
      <dc:date>2003-03-26T14:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936147#M929019</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm sorry but Ross already gave you the answer :^). To match an isolated word, use -w option of grep.&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Wed, 26 Mar 2003 14:22:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936147#M929019</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-03-26T14:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936148#M929020</link>
      <description>Hi Jack,&lt;BR /&gt;I think that grep -w is only available for 11.11 and newer.&lt;BR /&gt;&lt;BR /&gt;You can make use of the  underscore character that follows immediately after the string MSC_ID.&lt;BR /&gt;The underscore belongs to the :punct: class, and you can make an unreadable regular expression that says that if such a character??comes immediately after your string, then do not match it.&lt;BR /&gt;Infile example:&lt;BR /&gt;&lt;BR /&gt;MSC_ID 093-234&lt;BR /&gt;MSC_ID_LIST 1157&lt;BR /&gt;MSC_ID.LIST 1157&lt;BR /&gt;MSC_ID;LIST 1157&lt;BR /&gt;MSC_ID:LIST 1157&lt;BR /&gt;&lt;BR /&gt;Command on my 11.0 system:&lt;BR /&gt;# grep -E "MSC_ID[^[:punct:]]" ./infile&lt;BR /&gt;&lt;BR /&gt;MSC_ID 093-234&lt;BR /&gt;&lt;BR /&gt; See e.g. man tr for other classes, &lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Mar 2003 14:45:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936148#M929020</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-03-26T14:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: The grep pattern?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936149#M929021</link>
      <description>Hi Jack:&lt;BR /&gt;&lt;BR /&gt;John K. is correct.  The '-w' option for 'grep appears in HP-UX at 11.11.  For earlier, standard HP-UX releases, we can embellish the matching to cover (more) cases, as for instance, where your token occurs anchored to the beginning or end of a line, etc. with:&lt;BR /&gt;&lt;BR /&gt;# echo "MSC_ID"|grep -E -e "MSC_ID[^[:punct:]]" -e "MSC_ID$" | grep -E -e "[^[:punct:]]MSC_ID" -e "^MSC_ID"&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 27 Mar 2003 02:09:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/the-grep-pattern/m-p/2936149#M929021</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-03-27T02:09:04Z</dc:date>
    </item>
  </channel>
</rss>

