find排除文件 linux_Linux下find一次查找多个指定类型文件,指定文件或者排除某类文件,在 GREP 中匹配多个关键...
Linux下find一次查找多個指定文件或者排除某類文件,在 GREP 中匹配多個關(guān)鍵字的方法
(1)Linux下find一次查找多個指定文件:
查找a.html和b.html
find . -name "a.html" -name "b.html"
find . -regex '.*\.txt\|.*\.doc\|.*\.mp3'
find . -regex '.*\.txt\|.*\.doc\|.*\.mp3'
./a.txt
./a.doc
./a.mp3
(2)排除某些文件類型:
排除目錄下所有以html結(jié)尾的文件:
find . -type f ! -name "*.html"
./ge.bak.02.09
./ge.html.changed.by.jack
./a.txt
./a.doc
./a.mp3
(3)排除多種文件類型的示例:
find . -type f ! -name "*.html" -type f ! -name "*.php" -type f ! -name "*.svn-base" -type f ! -name "*.js" -type f ! -name "*.gif" -type f ! -name "*.png" -type f ! -name "*.cpp" -type f ! -name "*.h" -type f ! -name "*.o" -type f ! -name "*.jpg"
(4)在 GREP 中匹配多個關(guān)鍵字的方法:
grep查找多個數(shù)字的文件:
-r 遞歸,-E:正則??-l:只顯示文件名
root@116.255.139.240:~/a# grep -r -E '0341028|100081|10086|10001' *
a.txt:100081
b.txt:10086
c/cc.txt:0341028
c/cc.txt:100081
c/cc.txt:10086
c/cc.txt:10001
c.txt:10001
d.txt:0341028
grep -r -E -l '0341028|100081|10086|10001' *
a.txt
b.txt
c/cc.txt
c.txt
d.txt
多種類型文件示例:
find . -name "*.html" -o -name "*.js"|xargs grep -r "BusiTree"
總結(jié)
以上是生活随笔為你收集整理的find排除文件 linux_Linux下find一次查找多个指定类型文件,指定文件或者排除某类文件,在 GREP 中匹配多个关键...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html验证座机号码_html5表单pa
- 下一篇: a55 matlab排列组合_matla