Suppose there is a modules_classes/ directory with player.rb and wrapper.rb files. Write a command that finds all lines in the file with the word dog.
$ grep dog modules_classes/wrapper.rb
Now, let’s search all the files in the modules_classes/ directory for the word dog. This code will not work:
$ grep dog modules_classes/
We need to add a flag to the command so grep knows to perform a recursive search throughout the directory.
$ grep class -R modules_classes/
If we also wanted to perform a case-insensitive search, we would need to add the -i flag:
$ grep class -iR modules_classes/
ack is a wonderful tool for searching source code that programmers also love.