How can I grep for a certain string recursively in all .htaccess files?
grep -r -n -H -I 'string' .htaccess
doesn't seem to work.
I'm on a GNU Linux system.
How can I grep for a certain string recursively in all .htaccess files?
grep -r -n -H -I 'string' .htaccess
doesn't seem to work.
I'm on a GNU Linux system.
Use the --include
option:
grep -rnHI 'pattern' --include=.htaccess .
cd to a folder before the folders that store the htaccess
$find . -name ".htaccess" -exec grep -r -n -H -I 'string' {} \;
You can also specify to 'find' that it needs to look for regular files only:
$ find /usr/local -type f -name ".htaccess" -exec grep -rnHI 'pattern' {} \;
You can specify from where your search should begin. For this example, 'find' will look into all directories and sub directories under /usr/local.