Laxmikant Gurnalkar Laxmikant Gurnalkar - 1 month ago 5
Linux Question

grep recursively for a specific file type in Linux terminal

Can we search a term (eg. "onblur") recursively in some folders only in specific files (html files)?

grep -Rin "onblur" *.html

This returns nothing. But,

grep -Rin "onblur" .

search result from all available files, like in text(".txt"), .mako, .jinja etc.


Consider checking this answer and that one.

Also this might help you: grep certain file types recursively |

The command is:

grep -r --include="*.[ch]" pattern .

And in your case it is:

grep -r --include="*.html" "onblur" .