这两个命令能不能合成一个
find /data/sharedata/cmsdata/webapps -name ".xls" | xargs -i cp {} /root/xls
find /data/sharedata/cmsdata/webapps -name ".xls" >> xls.txt
下面我测试了两种,你看看
1 这样写是可以的亲测有效
find . -name "*.txt" -exec cp {} /root/test.txt \; -exec cat {} >> test2.txt \;
2 你是不是想要这种?这种也可以
[root@client abc]$ cat hello.txt #创建一个文件测试
hello world、
[root@client abc]$ find . -name "*.txt" -exec cp {} /root/test1.ab \; -exec echo {} > test2.ab \; #执行操作命令
[root@client abc]$ ls #查看已经生成
hello.txt test2.ab
[root@client abc]$ cat test2.ab #文件路径名称保存在这
./hello.txt
[root@client abc]$ cat /root/test1.ab #复制的文件
hello world
试试这个
find . -name 'txt' | tee -a test.txt | xargs ls -lht
可以的,我写下给出来个参考
find命令详解 要熟悉每一个步骤
https://blog.csdn.net/qq_38925100/article/details/123224850