You are using globbing characters (aka "wildcards") where grep
is expecting a regular expression. However, in regular expressions, the *
does not mean "any sequence of characters", but "zero or more of the previous character". When it is used as the first character of an expression (or immediately after the "start-of-line" symbol ^
), it stands for a literal asterisk.
So, your expression ^*DEFUN*event*$
searches for lines that
- start with an
*
- immediately continue with
DEFU
- followed by zero or more
N
- followed by the word
even
- and continuing with zero or more
t
up to the end of the line.
The regular expression you are looking for would be
^.*DEFUN.*event.*$
or in short (as also mentioned by Stéphane Chazelas in a comment)
DEFUN.*event
*
is incorrect here, as it doesn't mean "any sequence of characters" but "zero or more of the preceding character". So, you are looking for lines containingDEFUNevent
orDEFUNNevent
and the like. – AdminBee Apr 05 '22 at 15:17grep -nr 'DEFUN.*event' .
here. – Stéphane Chazelas Apr 05 '22 at 15:21