how do I use the grep --include option for multiple file types?

后端 未结 7 1915
故里飘歌
故里飘歌 2020-12-04 10:40

When I want to grep all the html files in some directory, I do the following

grep --include=\"*.html\" pattern -R /some/path

which works well. T

7条回答
  •  一个人的身影
    2020-12-04 11:04

    Use grep with find command

    find /some/path -name '*.html' -o -name '*.htm' -o -name '*.php' -type f 
     -exec grep PATTERN {} \+
    

    You can use -regex and -regextype options too.

提交回复
热议问题