find -name "*" |xargs grep "xxx" ubuntu搜索
来源:互联网 发布:淘宝卖家图片轮播 编辑:程序博客网 时间:2024/05/17 00:03
在ubuntu中搜索文件一直是用的: find -name "*" |xargs grep “xxx",在用了一阵后感觉这命令还是太好,显示的搜索信息太多了,不匹配的搜索结果也显示在控件台中,百度了一下,可以用以下两个参数:
xxxx@ubuntu:~/project/MSM8916_R113502NEW/LINUX/android/packages$ find -name "*" |xargs grep -s "custom_content_page"
./apps/Launcher3/res/layout/custom_content_page_indicator_marker.xml: android:src="@drawable/custom_content_page"
./apps/Launcher3/res/layout/custom_content_page_indicator_marker.xml: android:src="@drawable/custom_content_page"
xxxx@ubuntu:~/project/MSM8916_R113502NEW/LINUX/android/packages$ find -name "*" |xargs grep -l "custom_content_page"
./apps/Launcher3/res/layout/custom_content_page_indicator_marker.xml
参数-s 与的-l的区别是 -s 会显示要搜索内容,而-l只会显示匹配搜索的文件名:
如果想查找当前目录(/home/student)下的tmp.txt文件,但是想要避开sep目录:
find /home/student -path /home/student/sep -prune -o -name "tmp.txt" -print
sep后面不能加/ 即/home/student/sep/是错误的 如果当前目录为/home/student 也可以这样
find . -path ./sep -prune -o -name "tmp.txt" -print
总结:-path 只是匹配find出来的路径,可以通过使用匹配符号* [] ?等 例如:
[student@bioeng ~]$ find . -name file
./file
./dir/file
./dir/dir555/file
./dir/dir2/file
./dir/dir1/file
[student@bioeng ~]$
[student@bioeng ~]$ find . -path "*dir[12]" -prune -o -name file -print
./file
./dir/file
./dir/dir555/file
[student@bioeng ~]$ [student@bioeng ~]$ find . -path "*dir*" -prune -o -name file -print
./file
[student@bioeng ~]$
- find -name "*" |xargs grep "xxx" ubuntu搜索
- 模拟类似linux:find . -name "*.*" |xargs grep -i "搜索字符串"
- find ./www/ -type f -name "*.php" | xargs grep "phpinfo"
- find . -name \* -type f -print | xargs grep “关键字”
- find xargs grep ...
- grep 、find、xargs使用方法
- find |xargs |grep命令
- find xargs grep 查找技巧
- alias、grep、wc、find、xargs
- linux 的 find,xargs,grep
- find、xargs、grep基本用法
- find -name "*.c"|xargs touch
- find、grep、xargs命令的结合使用
- find、grep、xargs命令的结合使用
- linux查找技巧: find grep xargs
- linux查找技巧: find grep xargs
- linux查找技巧: find grep xargs
- 【牛x】 find ./* | xargs grep "Invalid configuration"
- android TextView不会自动换行怎么办,教你使用staticlayout解决换行
- CornerStone SVN使用
- bzoj1787.紧急集合(倍增LCA)
- hihoCoder #1054 dfs
- 如何打开Oracle的dmp文件
- find -name "*" |xargs grep "xxx" ubuntu搜索
- Spring scope属性详解
- NYOJ 528 找球号(三) 【位运算 ^ 】
- 定位Release 版本中程序崩溃的位置 ---利用map文件 拦截windows崩溃函数
- Android数据层解析层解耦问题
- java排列三个随机数
- 重走一次java-堆栈之int,Integer,String定义变量
- 数据库连接及操作类 ConnDB
- golang截取中文字符串