Comb line recursively in all .htaccess files

How can I grep for a specific line recursively in all .htaccess files?

grep -r -n -H -I 'string' .htaccess

doesn't seem to work.

I am on a GNU Linux system.

+3
source share
3 answers

cd to the folder in front of the folders where htaccess is stored

$find . -name ".htaccess" -exec grep -r -n -H -I 'string' {} \;
+8
source

Use option --include:

grep -rnHI 'pattern' --include=.htaccess .
+3
source

"", :

  $ find /usr/local -type f -name ".htaccess" -exec grep -rnHI 'pattern' {} \;

, . "find" /usr/local.

+2

Source: https://habr.com/ru/post/1714277/


All Articles