linux – “grep -rnw”:在所有文件中搜索字符串
发布时间:2020-12-25 07:10:06 所属栏目:Linux 来源:网络整理
导读:相关问题: How do I find all files containing specific text on Linux? 我一直在使用上面问题的答案中提到的命令来搜索所有文件中的字符串出现: grep -rnw '/path/to/somewhere/' -e "pattern" 但是最近我遇到了一个问题,如下图所示: 看起来这个命令只
相关问题: How do I find all files containing specific text on Linux? 我一直在使用上面问题的答案中提到的命令来搜索所有文件中的字符串出现: grep -rnw '/path/to/somewhere/' -e "pattern" 但是最近我遇到了一个问题,如下图所示: 看起来这个命令只能识别出作为单词或其他东西突出的字符串.我该如何修改命令以改善搜索结果? 解决方法explainshell有助于解释你的命令,并摘录了man grep:-w,--word-regexp Select only those lines containing matches that form whole words. 所以只需删除-w,因为它明确地执行了您不想要的操作: grep -rn '/path/to/somewhere/' -e "pattern" (编辑:拼字网 - 核心网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- linux – yum-plugin-priorities:由于存储库优先级保护而排
- hrtimer在Linux内核中重复任务
- [Linux] linux下安装配置 zookeeper/redis/solr/tomcat/IK分
- iphone5三网v版是什么意思
- 可有可无还是“真香现
- httpd: apr_sockaddr_info_get() failed for bogon
- Linux 上文件编辑器 Emacs 终极攻略
- Linux命令:文件查找相关 Whereis、find和locate+updatedb
- Fatal error: Call to undefined function json_decode()解
- iphone打开软件闪退怎么办
站长推荐