Shell: grep in specific files in a subfolder
If you need to search textual occurrences of a pattern in files inside of a specific subfolder, the following command might come in handy for you:
find . -path './folder-prefix-*/target/*.java' -exec grep -iHn "search pattern" {} \;
This will find files matching the specific "-path" pattern and greps the resulting files for occurrences of "search pattern" ignoring case.
Written by Alex Heusingfeld
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#