is grep broken (4.2)

Marc Elvy elvy at harvard.ARPA
Thu Aug 16 04:02:11 AEST 1984


I think that grep is still working correctly.  It is my understanding
that grep will match any pattern you give it, wherever it appears within
a line (or word).  Therefore, "grep am.le /usr/dict/words" matches amble
and ample, because they match the specification exactly, AND amulet and
bramble, because the pattern exists within the words.  In all cases, the
dot IS only matching one character.  In order to match words of the exact
length of the pattern, you might consider using the -w switch, which indicates
to grep that it should print only a word which matches in its entirety
(rather like <word> in ex).  Therefore, "grep -w am.le /usr/dict/words"
prints the five-character words for which you are looking.

Marc

		      Marc A. Elvy  ( elvy at harvard.{arpa,uucp} )
			     Aiken Computation Laboratory
				  Harvard University



More information about the Comp.unix mailing list