我正在使用Xshell ssh一个Unix服务器,我正在尝试搜索包含特定文本的文件..
我正在使用的命令是:grep -ilr "blah_blah_text" ./
它找到了我要找的东西,但也发出了这些警告:
grep:警告:./ snn / pages / dvorak / xhtml / mh370 / asia / dvorak /found: 递归目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/ocean/dvorak/testing/sea:递归 目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/ocean/dvorak/testing/found:递归 目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/ocean/testing/dvorak/found:递归 目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/ocean/testing/dvorak/monday:递归 目录循环
grep:警告:./ snn / pages / dvorak / xhtml / mh370 / code / testing /found: 递归目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/testing/dvorak/ocean/sea:recursive 目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/testing/dvorak/ocean/monday:递归 目录循环
grep:警告:./ snv / pages / dvorak / xhtml / mh370 / testing / devorak / monday: 递归目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/testing/ocean/dvorak/found:递归 目录循环
grep:警告: ./svn/pages/dvorak/xhtml/mh370/testing/ocean/dvorak/monday:递归 目录循环
grep:警告:./ snn / pages / dvorak / xhtml / mh370 / testing /ocean / monday: 递归目录循环
grep:警告:./ snn / pages / gulf / xhtml / qwerty / asia / dvorak /found: 递归目录循环
grep:警告:./ snn / pages / gulf / xhtml / qwerty / asia / dvorak / testing / sea: 递归目录循环
grep:警告: ./svn/pages/gulf/xhtml/qwerty/ocean/dvorak/testing/found:递归 目录循环
grep:警告: ./svn/pages/gulf/xhtml/qwerty/ocean/testing/dvorak/found:递归 目录循环
grep:警告: ./svn/pages/gulf/xhtml/qwerty/ocean/testing/dvorak/monday:递归 目录循环
grep:警告:./ snn / pages / gulf / xhtml / qwerty / core / testing /found: 递归目录循环
grep:警告:./ snn / pages / gulf / xhtml / qwerty / dvorak / copa /海: 递归目录循环
grep:警告:./ snn / pages / gulf / xhtml / qwerty / dvorak / copa / testing / sea: 递归目录循环
grep:警告: ./svn/pages/gulf/xhtml/qwerty/dvorak/ocean/testing/found:递归 目录循环
grep:警告:./ snn / pages / gulf / xhtml / qwerty / dvorak / testing /海: 递归目录循环
grep:警告:./ snn / pages / gulf / xhtml / qwerty / dvorak / testing /ocean / sea: 递归目录循环
grep:警告: ./svn/pages/gulf/xhtml/qwerty/dvorak/testing/ocean/monday:递归 目录循环
grep:警告:./ snn / pages / india / xhtml / abcd / testing / dvorak / copa /海: 递归目录循环
grep:警告: ./svn/pages/india/xhtml/abcd/testing/dvorak/ocean/monday:递归 目录循环
grep:警告:./ snn / pages / india / xhtml / abcd / testing / dvorak / monday: 递归目录循环
grep:警告: ./svn/pages/india/xhtml/abcd/testing/ocean/dvorak/found:递归 目录循环
grep:警告: ./svn/pages/india/xhtml/abcd/testing/ocean/dvorak/monday:递归 目录循环
grep:警告:./ snn / pages / india / xhtml / abcd / testing / ance /monday: 递归目录循环
grep:警告:./ snn / pages / india / xhtml / abcd / dvorak / copa /海: 递归目录循环
grep:警告:./ snn / pages / india / xhtml / abcd / dvorak / copa / testing / sea: 递归目录循环
grep:警告: ./svn/pages/india/xhtml/abcd/dvorak/ocean/testing/found:递归 目录循环
grep:警告:./ snn / pages / india / xhtml / abcd / dvorak / testing / sea: 递归目录循环
grep:警告:./ snn / pages / india / xhtml / abcd / dvorak / testing /ocean / sea: 递归目录循环
grep:警告: ./svn/pages/india/xhtml/abcd/dvorak/testing/ocean/monday:递归 目录循环
这些消息是什么意思?
答案 0 :(得分:12)
您必须从grep中排除符号链接,它们是此警告的原因。您应该首先尝试使用find:
find ./ -type f -exec grep -il "blah_blah_text" {} \;
当你首先使用find时,你可以在grep中省略-r,因为find已经是递归的。