How can I search for a multiline pattern in a file?

后端 未结 11 990
陌清茗
陌清茗 2020-11-22 14:59

I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using find piped with xargs grep:

11条回答
  •  北海茫月
    2020-11-22 15:40

    With silver searcher:

    ag 'abc.*(\n|.)*efg'
    

    Speed optimizations of silver searcher could possibly shine here.

提交回复
热议问题