shell命令find查找或条件

在linux中如何用find查找或条件

MacBook-Air:test yansy$ ls

MacBook-Air:test yansy$ 1.jpg 1.txt test.jpg test.txt

MacBook-Air:test yansy$ find . ! -name "test" -name "*txt" -o -name "*.jpg"

./1.jpg

./1.txt

./test.jpg

./test.txt

MacBook-Air:test yansy$ find . ! -name "test*" -name "*txt" -o ! -name "test*" -name "*.jpg"./1.jpg./1.txt

./1.jpg

./1.txt

也可以执行以下命令查找

[yansiyu@iZbp1fna7ky0qz2jbj7gfpZ test]$ find . -type f -regex ".*\(\.txt\|.jpg\)"

./1.txt

./1.jpg

 

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: