如何限制在 bash 中查找命令的结果? [英] How do I limit the results of the command find in bash?
本文介绍了如何限制在 bash 中查找命令的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下命令:
find . -name "file2015-0*" -exec mv {} .. ;
影响大约 1500 个结果.他们一个接一个地移动上一个级别.
Affects about 1500 results. One by one they move a previous level.
如果我希望结果不超过例如 400?我怎么可能?
If I would that the results not exceeds for example in 400? How could I?
推荐答案
你可以这样做:
find . -name "file2015-0*" | head -400 | xargs -I filename mv filename ..
如果你想模拟它确实使用echo
:
If you want to simulate what it does use echo
:
find . -name "file2015-0*" | head -400 | xargs -I filename echo mv filename ..
这篇关于如何限制在 bash 中查找命令的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文