linux shell中利用关键字批量移动或复制文件
001、
[root@localhost test3]# ls a34 a45 b34 b54 c23 c34 dirab [root@localhost test3]# tree . ├── a34 ├── a45 ├── b34 ├── b54 ├── c23 ├── c34 └── dirab 1 directory, 6 files ## 将该目录中以a和以b开头的文件或者目录复制到dirab中去 [root@localhost test3]# for i in a b; do ls | grep "^$i" | while read j; do cp $j dirab/; done; done