阅读:5310回复:1

linux查找命令

楼主#
更多 发布于:2019-11-21 20:42
find :1、查找当前目录下.java文件中,最近30分钟内修改过的文件。
find . -name *.java -type f -mmin -30


2、查找当前目录下a.java或b.java
find . -name a.java -o -name b.java


3、查找当前目录下除.h外的文件
find . -type f ! -name *.h


4、排除多种文件类型
find . -type f ! -name *.h -type f ! -name *.java -type f ! -name *.mk


5、指定文件类型的查找字符串
find . -name "*.xml" |xargs grep -i "OMX.MTK.VIDEO.DECODER.MPEG2"



grep :
1、grep或(满足任一条件即匹配)
grep -E "word1|word2|word3" file.txt
egrep "word1|word2|word3" file.txt



2、grep与(需同时满足)
grep word1 file.txt | grep word2 | grep word3


3、显示匹配字符串的上下n行、前n行、后n行
前后5行:grep -C 5 "test" file.txt
前5行:grep -B 5 "test" file.txt
后5行:grep -A 5 "test" file.txt


混合使用例子:
git log --oneline --all | grep -i -E "动画|铃声|logo" | grep "预置"

find device/ -type f ! -name *.xml | xargs grep -s -n --color "PRODUCT_MODEL"

最新喜欢:

zhaoyf13zhaoyf... VastStarGamesVastSt...
沙发#
发布于:2019-11-22 09:44
so good
[url]http://190.lsal.cn/195/1329.gif?0728100424873[/url]
游客

返回顶部