linux 如何在文本文件中用Terminal的grep命令查找一个词
来源:互联网 发布:怎样申请做淘宝模特 编辑:程序博客网 时间:2024/06/03 23:00
问题
当ubuntu中,想查找一个词语在哪个文件里出现过, 用什么命令呢?
解决方法
1 在当前路径下全文件查找任何文件中包含的s:grep -r "s" *
2 在文件a中查找s并且显示行号:grep -nr "s" a
3 实例
aston@ubuntu:~/Downloads$ grep -r "s" * //全路径搜索,不显示行号Binary file .v.c.swp matchesBinary file sogoupinyin_2.1.0.0086_i386(1).deb matchesa:sa:asa:sa:pasfasBinary file sogoupinyin_2.1.0.0086_i386.deb matchesBinary file sogoupinyin_2.1.0.0086_amd64.deb matchesBinary file .a.c.swp matchesaston@ubuntu:~/Downloads$ grep -nr "s" * //全路径搜索,并且显示行号Binary file .v.c.swp matchesBinary file sogoupinyin_2.1.0.0086_i386(1).deb matchesa:1:sa:7:asa:12:sa:13:pasfasBinary file sogoupinyin_2.1.0.0086_i386.deb matchesBinary file sogoupinyin_2.1.0.0086_amd64.deb matchesBinary file .a.c.swp matchesaston@ubuntu:~/Downloads$ grep -r "s" a //在文件a中搜索s,不显示行号sasspasfas
阅读全文
0 0
- linux 如何在文本文件中用Terminal的grep命令查找一个词
- linux 如何在Terminal中用find查找文件
- [每天一个Linux小技巧] terminal中快速查找之前的命令
- Linux 的 grep 命令 查找信息
- linux查找命令、find、grep
- linux 命令 文本查找 grep
- Linux命令 --- 查找筛选grep
- [Shell]一个特好用的查找命令 find + grep
- 如何在intellij 的终端(terminal) 使用git命令
- grep 命令(在指定文件的文件类型中查找)
- 在文件中查找特定的字符串方法 grep命令
- linux查找命令、find、grep找到需要的文件
- Linux命令-----grep不查找隐藏文件夹的方法
- Linux命令-----grep不查找隐藏文件夹的方法
- linux查找命令、find、grep找到需要的文件
- linux grep命令(查找文件里符合条件的字符串)
- Linux命令-----grep不查找隐藏文件夹的方法
- linux查找命令、find、grep找到需要的文件
- 2.Java虚拟机内存模型及分区
- HashSet和CopyOnWriteArraySe
- Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable
- Angular2 响应式表单验证
- initializer element is not constant
- linux 如何在文本文件中用Terminal的grep命令查找一个词
- Node.js实现GitHub第三方登录
- WebLogic安装
- c++中“箭头”和“点号”操作符的区别
- Sql Server 2005 32位+64位、企业版+标准版、CD+DVD 下载地址大全
- 剑指Offer—45—扑克牌顺子
- tensorflow学习——tf.get_collection(), tf.identity()
- windows下Mingw(GCC) 编译Berkeley db4.8.30.NC
- BZOJ4538:[Hnoi2016]网络 (整体二分+Lca+树状数组/线段树+路径交/树链剖分+Heap)