2013-04-10 20:17阅读:
Linux下find一次查找多个指定文件或者排除某类文件,在 GREP 中匹配多个关键字的方法
(1)Linux下find一次查找多个指定文件:
查找a.html和b.html
find . -regex '.*\.txt\|.*\.doc\|.*\.mp3'
(2)排除某些文件类型:
排除目录下所有以html结尾的文件:
(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结尾的文件:
- find
. -type f ! -name '*.html'
- find
. -type f ! -name '*.html' - ./ge.bak.02.09
