How to match once per file in grep?

后端 未结 6 1096
再見小時候
再見小時候 2021-02-06 20:38

Is there any grep option that let\'s me control total number of matches but stops at first match on each file?

Example:

If I do this grep -ri --include \'*

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-06 21:14

    So, using grep, you just need the option -l, --files-with-matches.

    All those answers about find, awk or shell scripts are away from the question.

提交回复
热议问题