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

后端 未结 11 1130
陌清茗
陌清茗 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 16:02

    This answer might be useful:

    Regex (grep) for multi-line search needed

    To find recursively you can use flags -R (recursive) and --include (GLOB pattern). See:

    Use grep --exclude/--include syntax to not grep through certain files

提交回复
热议问题