grep without showing path/file:line

前端 未结 3 624
难免孤独
难免孤独 2020-11-30 19:59

How do you grep and only return the matching line? i.e. The path/filename is omitted from the results.

In this case I want to look in all .bar files in the current d

3条回答
  •  爱一瞬间的悲伤
    2020-11-30 20:28

    Just replace -H with -h. Check man grep for more details on options

    find . -name '*.bar' -exec grep -hn FOO {} \;
    

提交回复
热议问题