<?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 -E (with regular expression) \b in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217713#M169765</link>
    <description>To answer two questions about 10.20: no, grep will never have the -w option, and no, you do not have Perl version 5 in 10.20, only Perl 4 which is fairly incompatile with Perl 5 coding. 10.20 has been a dead end since Dec 2001.</description>
    <pubDate>Sat, 13 Mar 2004 14:24:21 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2004-03-13T14:24:21Z</dc:date>
    <item>
      <title>grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217701#M169753</link>
      <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;I'm trying to use grep -E (regular expression)&lt;BR /&gt;with \b (word boundary) in csh without success.&lt;BR /&gt;(grep -E $path '\b\/usr....\b')&lt;BR /&gt;&lt;BR /&gt;Is there any way to use \b, \s etc with grep?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Reggie</description>
      <pubDate>Fri, 12 Mar 2004 16:30:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217701#M169753</guid>
      <dc:creator>Reggie Chang</dc:creator>
      <dc:date>2004-03-12T16:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217702#M169754</link>
      <description>what version of grep are you using, what /usr/bin/grep?&lt;BR /&gt;&lt;BR /&gt;at 11.11 grep has the -w option that matches only words</description>
      <pubDate>Fri, 12 Mar 2004 17:02:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217702#M169754</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-03-12T17:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217703#M169755</link>
      <description>Curt,&lt;BR /&gt;&lt;BR /&gt;I'm using 10.20.  I don't know what&lt;BR /&gt;version if grep it is, but it is located&lt;BR /&gt;at /usr/bin.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Reggie&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Mar 2004 17:10:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217703#M169755</guid>
      <dc:creator>Reggie Chang</dc:creator>
      <dc:date>2004-03-12T17:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217704#M169756</link>
      <description>grep at 10.20 does not have the -w (word boundary) option. You'll have to upgrade to 11.11 with the latest patches to have that feature. \b is not a part of regular expressions so grep can't parse it.</description>
      <pubDate>Fri, 12 Mar 2004 17:15:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217704#M169756</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-03-12T17:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217705#M169757</link>
      <description>Bill,&lt;BR /&gt;&lt;BR /&gt;Thank you for the info.&lt;BR /&gt;&lt;BR /&gt;I did not see -w in grep man page.&lt;BR /&gt;I'll find some other way since I'm&lt;BR /&gt;stuck with 10.20 at this moment.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Reggie&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Mar 2004 17:22:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217705#M169757</guid>
      <dc:creator>Reggie Chang</dc:creator>
      <dc:date>2004-03-12T17:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217706#M169758</link>
      <description>you could also use the blank or space character classes&lt;BR /&gt;&lt;BR /&gt;grep -E '[:space:]...[:space:]'&lt;BR /&gt;or&lt;BR /&gt;grep -E '[:blank:]...[:blank:]'&lt;BR /&gt;&lt;BR /&gt;not even the -w switch is going to work for you in this case because both : and / are non word characters&lt;BR /&gt;&lt;BR /&gt;your going to have to use perl or write your own&lt;BR /&gt;&lt;BR /&gt;function notInPath {&lt;BR /&gt;typeset field&lt;BR /&gt;print $2 | &lt;BR /&gt;awk -v field=$1 -F: '{&lt;BR /&gt;if (NR &amp;gt; 1) exit;&lt;BR /&gt;for ( i=1; i&amp;lt;=NF; i++ ) {&lt;BR /&gt;  if ( field == $i ) exit 1;&lt;BR /&gt;}&lt;BR /&gt;exit 0;}'&lt;BR /&gt;return&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;notInPath /usr/bin $PATH&lt;BR /&gt;if [[ $? = 0 ]] ;then&lt;BR /&gt;print "not in path"&lt;BR /&gt;else&lt;BR /&gt;print "it is in the path"&lt;BR /&gt;fi</description>
      <pubDate>Fri, 12 Mar 2004 17:23:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217706#M169758</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-03-12T17:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217707#M169759</link>
      <description>Curt,&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for the info.&lt;BR /&gt;&lt;BR /&gt;Please forgive my dumb questions.&lt;BR /&gt;Is function notInPath in Perl?&lt;BR /&gt;Does shell script (C-shell or others)&lt;BR /&gt;support function?&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Reggie&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Mar 2004 21:20:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217707#M169759</guid>
      <dc:creator>Reggie Chang</dc:creator>
      <dc:date>2004-03-12T21:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217708#M169760</link>
      <description>the syntax for the function i provide is written for the posix shell or the korn shell.  A portion of it could be call an awk script.&lt;BR /&gt;&lt;BR /&gt;still using posix shell syntax, but using perl instead of awk&lt;BR /&gt;&lt;BR /&gt;print "$PATH" |&lt;BR /&gt;/opt/perl/bin/perl -F: -ane '&lt;BR /&gt;foreach $str (@F) {&lt;BR /&gt;if ( $str =~ m|^/usr/bin$| ) {&lt;BR /&gt;exit 1;&lt;BR /&gt;}};exit 0;'&lt;BR /&gt;&lt;BR /&gt;if [[ $? = 0 ]] ;then&lt;BR /&gt;print "not in path"&lt;BR /&gt;else&lt;BR /&gt;print "it is in the path"&lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;the above example doesn't use a function</description>
      <pubDate>Sat, 13 Mar 2004 00:55:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217708#M169760</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-03-13T00:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217709#M169761</link>
      <description>another easy way would be&lt;BR /&gt;&lt;BR /&gt;print $PATH |&lt;BR /&gt;tr ":" "\012" |&lt;BR /&gt;grep -x /usr/bin &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;if [[ $? = 0 ]] ;then&lt;BR /&gt;print "/usr/bin is in \$PATH"&lt;BR /&gt;else&lt;BR /&gt;print "/usr/bin is not in \$PATH"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;of if you like to switch the logic&lt;BR /&gt;&lt;BR /&gt;num=$(print $PATH |&lt;BR /&gt;tr ":" "\012" |&lt;BR /&gt;grep -cx /usr/bin &amp;gt;/dev/null 2&amp;gt;&amp;amp;1)&lt;BR /&gt;&lt;BR /&gt;if [[ $num = 0 ]] ;then&lt;BR /&gt;print "/usr/bin is not in \$PATH"&lt;BR /&gt;else&lt;BR /&gt;print "/usr/bin is in \$PATH"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 13 Mar 2004 01:14:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217709#M169761</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-03-13T01:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217710#M169762</link>
      <description>I might be being a bit dim here but doesn't this do what you want&lt;BR /&gt; &lt;BR /&gt;echo $path|perl -ne "if(/\b\/usr...\b/){print}"&lt;BR /&gt;</description>
      <pubDate>Sat, 13 Mar 2004 05:36:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217710#M169762</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-03-13T05:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217711#M169763</link>
      <description>Hi,&lt;BR /&gt;if you have to use a regular expression you probably have to adapt it to your needs. The following is just a suggestion:&lt;BR /&gt;# grep -E "(^|[^a-zA-Z0-9])ordet([^a-zA-Z0-9]|$)" infile&lt;BR /&gt; &lt;BR /&gt;which will try to look for the literal string&lt;BR /&gt;ordet&lt;BR /&gt;in infile. It does not take boundaries like e.g. special characters or tabs into account, but has already developed into something that gives unix a reputation as not easily understandable.....&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 13 Mar 2004 06:18:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217711#M169763</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-03-13T06:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217712#M169764</link>
      <description>Mr. Grant,&lt;BR /&gt;&lt;BR /&gt;in this case the data being compared makes using word boundaries impossible.  He wants to do this on his path variable, a colon delimited string of directory names.  In this situation the word boundary is :/, which isn't matched by perl's \b.  \W comes closer, but still won't match if what he is looking for is at the begining of the line.  And \W\/usr\/bin\W/ will match both /usr/bin and /usr/bin/X11.&lt;BR /&gt;&lt;BR /&gt;So, you end up doing something like&lt;BR /&gt;s/^/ /;tr /:/ /;if ( \W\/usr\/bin\W/ ) &lt;BR /&gt;to get it to work that way.</description>
      <pubDate>Sat, 13 Mar 2004 10:08:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217712#M169764</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-03-13T10:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: grep -E (with regular expression) \b</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217713#M169765</link>
      <description>To answer two questions about 10.20: no, grep will never have the -w option, and no, you do not have Perl version 5 in 10.20, only Perl 4 which is fairly incompatile with Perl 5 coding. 10.20 has been a dead end since Dec 2001.</description>
      <pubDate>Sat, 13 Mar 2004 14:24:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-e-with-regular-expression-b/m-p/3217713#M169765</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-03-13T14:24:21Z</dc:date>
    </item>
  </channel>
</rss>

