she*_*wen 13 linux grep full-text-search find
我一直在使用上面问题的答案中提到的命令来搜索所有文件中的字符串出现:
grep -rnw '/path/to/somewhere/' -e "pattern"
Run Code Online (Sandbox Code Playgroud)
看起来这个命令只能识别出作为单词或其他东西突出的字符串.我该如何修改命令以改善搜索结果?
tha*_*guy 21
explainshell有益解释你的命令,从给出的摘录man grep:
-w, --word-regexp
Select only those lines containing matches that form whole words.
Run Code Online (Sandbox Code Playgroud)
所以只需删除,-w因为明确地做了你不想要的东西:
grep -rn '/path/to/somewhere/' -e "pattern"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29924 次 |
| 最近记录: |