I know this question has been asked before but the proposed solutions don't work for me.
I'm trying to find the string "modelInstance.addObservers" in any file (ideally any file with the .js ending, but it's fine without this filter too) in the current directory and all subdirectories. Here's what I tried:
grep -rl "modelInstance.addObserver" .It behaves as if the statement is incomplete, because it keeps printing blank lines when I hit enter. What is the problem?
I'm on mac.
21 Answer
There is nothing wrong: your terminal echoes typed characters when no program is prompting for input; meanwhile grep is running, but not finding any files with the matching string.
It will be a lot faster if you restrict your searches to .js files by using find:
find . -name "*.js" -exec grep -l 'modelInstance\.addObservers' {} \;Note that I have escaped the . in the search string in order to match only a literal . and not an arbitrary character in that position.