I am trying to search in the root folder that contains a bunch of Joomla sites inside subfolders to have a sneak preview of the public $db
variable of the configuration.php
file of each site.
Note that the whole configuration.php
consists of many such variables:
Sample:
public $cache_handler = 'file';
public $cachetime = '15';
public $caching = '0';
public $captcha = '0';
public $cookie_domain = '';
public $cookie_path = '';
public $db = 'database_name';
I tried various options with grep, but either I get nothing or grep displays the contents of the whole configuration.php file of each subfolder.
grep -F -r "public $db" --include="configuration.php"
I suspect it might be related to the special characters in the search term, which somehow aren't treated as should, and grep finally searches for anything that contain "public"
-Whatever the case I need a bit of advise here on how to achieve this.
The final outcome I am after, is to get a list with the configuration.php files of each subfolder alongside with the whole line e.g. "public $db = 'database_name';
" of text where the public $db
variable exists.
e.g.
/folder1/configuration.php: public $db = "db1";
/folder2/configuration.php: public $db = "db2";
/folder3/configuration.php: public $db = "db3";