Hi there-
I've found what seems to be a pretty clear bug in grep. From the man page:
-w [Digital] Matches only if the expression is found as a separate word
in the text. A word is any string of alphanumeric characters (letters,
numerals, and underscores) delimited by nonalphanumeric characters
(punctuation or white space) or by the beginning or end of the line).
See ex.
But note this:
12:06pm% echo 'free' |grep -w e
free
It finds any double-occurrence at the end of a word:
12:08pm% echo 'garbagebigbig more words' | grep -w big
awefoijfbigbig more words
12:08pm% echo 'garbagebigbiggarbage more words' | grep -w big
<nothing - works correcly>
I haven't found any reference to this bug on the web - anyone have a fix?
A patch? We are working on a rather painful workaround:
12:15pm% echo 'free' |grep -Ei '(^|[^a-z0-9])(e)([^a-z0-9]|$)'
<no output - correct>
We're using Digital Unix version 4.0 . Thanks in advance.
-Ken Williams, The Math Forum
ken_at_forum.swarthmore.edu
Received on Mon Nov 24 1997 - 18:41:50 NZDT