linux 中find命令同时对多个关键字进行查找

 

[root@pc1 test2]# ls        ##测试数据
a.txt  b.csv  c.ped  test_dir
[root@pc1 test2]# ls test_dir/
[root@pc1 test2]# find ./ -name "*.txt" -o -name "*.ped" -exec cp {} test_dir/ \;   ## 查找,并复制到测试目录
[root@pc1 test2]# ls test_dir/        ## 仅出现第二个关键词的内容
c.ped
[root@pc1 test2]# rm test_dir/*
[root@pc1 test2]# ls test_dir/
[root@pc1 test2]# find ./ \( -name "*.txt" -o -name "*.ped" \) -exec cp {} test_dir/ \;   ## 查找,并复制至测试目录
[root@pc1 test2]# ls test_dir/         ## 查找成功
a.txt  c.ped

 。

posted @ 2023-09-20 08:53  小鲨鱼2018  阅读(745)  评论(0)    收藏  举报