Find files containing specific pattern among many similar files.
Here is how you can use grep to find to find file which contains the pattern, It is a pretty handy tool if you want to find which file contains the specific pattern. Say i need to find which file contain the word chrome in the file and lets assume its a javascript file that use chrome's API. Finding it is easy.
grep -r 'chrome' *
Use this and you will get all the files containing the word chrome in it. So the general code would be
grep -r '<pattern>' *
where 'pattern' is the word/pattern you are searching. Pretty handy, right!
Written by Vinit Kumar
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Tips
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#