2
我想递归搜索当前文件夹中包含的所有文件中的字符串,我正在执行grep。但是这个主机上的grep
似乎太旧了。这里有一些用法。grep -r不可用;现在怎么办?
>> grep -r "some string here" *.*
grep: illegal option -- r
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvwx] -e pattern_list...
[-f pattern_file...] [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvwx] [-e pattern_list...]
-f pattern_file... [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvwx] pattern [file...]
那么我应该怎么做我想要的?
或使其'找到一个新的
find
。 -type f -exec grep“some string here”{}/dev/null \;'如果您希望匹配文件名前面加上匹配。 – 2015-04-06 07:10:32屏幕只是闪烁,我看不到列出文件名的结果。 到目前为止,我设法使用以下语句: grep -F Ma/Dir/* 在所需的Dir中搜索字符串“Ma”。 – 2015-04-06 07:13:54
发现这个奇特的东西; d [www.computerhope.com(https://www.computerhope.com/unix/ugrep.htm) – 2015-04-06 07:19:58