Home » » Grep

Grep

grep a directory

If you'd rather just get the file names and skip the rest of the output, use the "-l" switch, like so:
grep -lr "modules" .
Here's another tip: grep also supports regular expressions, so matching against a wildcard pattern is easy:
grep -lr "mod.*" .
That command will print a list of files containing any word starting with "mod".
You can also use grep to search for multiple words:
grep -r "drupal\|joomla\|wordpress" .
And, of course, grep supports file name wildcards in the standard unix fashion. In this example, grep will search only file names starting with "log":
grep -lr "mod.*" ./log* 

[edit]find ,then grep

find . -name *.scala |xargs grep  "~>"

Popular Posts