Find all files matching 'name' on linux system, and search with them for 'text'

前端 未结 5 1514
猫巷女王i
猫巷女王i 2020-12-24 12:04

I need to find all instances of \'filename.ext\' on a linux system and see which ones contain the text \'lookingfor\'.

Is there a set of linux command line operation

5条回答
  •  清酒与你
    2020-12-24 12:37

    I find the following command the simplest way:

    grep -R --include="filename.ext" lookingfor
    

    or add -i to search case insensitive:

    grep -i -R --include="filename.ext" lookingfor
    

提交回复
热议问题