假设我输入这个命令:
find /etc/info/ -name ".c" | xargs -I {} grep -l 'importantFile' {}
现在我拥有了所有我感兴趣的文件,这些文件具有后缀 .c 和关键字“importantFile”。如何将其移动到我当前的目录之一(名称:文件夹)?
I tried:
find /etc/info/ -name ".c" | xargs -I {} grep -l 'importantFile' {} mv{} ./folder
但它不起作用。请帮忙:p
如果你喜欢坚持使用 find,类似这样的东西应该可以工作:
xargs -r0 --arg-file <(find . -name "*.c" -type f -exec grep -lZ importantFile {} +
) mv -i --target-directory ./folder
Try this
grep -lir 'importantFile' /etc/info/*.c | xargs mv -t ./folder
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)