Find text or string in files of a certain type

Posted by & filed under Linux, Mac OS X.

One can use grep “mystring” myfile.ext to find the lines in myfile.ext containing mystring. One could also use grep “mystring” *.ext to find mystring in all files with extension ext. Similarly, one could use grep “mystring” /directory to search for mystring in all files in the directory. What if one wants to search for mystring… Read more »

Find files and find files containing certain text

Posted by & filed under Linux.

This is a reminder to myself as I keep forgetting how to do these basic searches in Linux. To find files with file name containing the text foo using the command find: ## find file with “foo” in file name find ./ -name *foo* ## replace ./ with path; can use shell style wildcards ##… Read more »