How do I grep all files in a directory?

How do I grep all files in a directory?
Answer
By default, grep would skip all subdirectories. However, if you want to grep through them, grep -r $PATTERN * is the case. Note, the -H is mac-specific, it shows the filename in the results. To search in all sub-directories, but only in specific file types,
use grep with –include.
 

Tìm kiếm

Back
Top