I need to run a grep on my server to search for files which extend a CodeIgniter 1 file, as we are upgrading to CI2. In one folder contains several hundred site-specific folders like such:
dev/sitea.com/site/www
dev/siteb.com/site/www
dev/sitec.com/site/www
... and so on
How can I grep to find which folders directly under dev contain a file (or many files in variable subfolders) which references the string "MY_Output" (php file)
I'm aware of the -l
flag to list the files, but I'm not sure how to put it with other flags together to say "show me which websites contain files with this string"
Is this possible? Thanks!
EDIT: Just to clarify, these site level folders will contain files which extend MY_Output.php, which is a common shared file:
class Whatever extends MY_Output
Best Answer
This would be my approach:
Note use of the
print0
parameter tofind
and the-0
(zero) flag toxargs
, which prevents problems if your filenames have embedded spaces in them.