grep recursively for a specific file type on Linux

前端 未结 4 1375
抹茶落季
抹茶落季 2020-12-23 10:08

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

grep -Rin \"onblur\" *.html

This ret

4条回答
  •  清酒与你
    2020-12-23 10:22

    Consider checking this answer and that one.

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

    The command is:

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

    And in your case it is:

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

提交回复
热议问题