How do you exclude symlinks in a grep?

后端 未结 4 877
梦如初夏
梦如初夏 2020-12-30 18:36

I want to grep -R a directory but exclude symlinks how dow I do it?

Maybe something like grep -R --no-symlinks or something?

Thank

4条回答
  •  既然无缘
    2020-12-30 19:12

    If you're using an older grep that does not have the -r behavior described in Aryeh Leib Taurog's answer, you can use a combination of find, xargs and grep:

    find . -type f | xargs grep "text-to-search-for"
    

提交回复
热议问题