免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1893 | 回复: 4
打印 上一主题 下一主题

find and xargs 问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-02-13 13:16 |只看该作者 |倒序浏览
我想用find查找到一些文件然后用xargs加入命令将这些文件拷贝到其他地方,不知道怎么写命令?
一般例子都是find . -type f|xargs rm -f 感觉此时find结果是rm -f的最后的参数,
但拷贝时不是最后的参数
find . -type f|xargs cp $DESTDIR
因此不行,请教该怎么办呢?

论坛徽章:
0
2 [报告]
发表于 2007-02-13 13:22 |只看该作者
试试

  1. find . type f | xargs -i cp {} $DESTDIR
复制代码

论坛徽章:
0
3 [报告]
发表于 2007-02-13 13:23 |只看该作者
原帖由 Edengundam 于 2007-2-13 13:22 发表
试试

  1. find . type f | xargs -i cp {} $DESTDIR
复制代码


管用,谢啦

论坛徽章:
0
4 [报告]
发表于 2007-02-13 15:39 |只看该作者

厉害啊。。。

请问:xargs的参数-i是什么意思啊?

论坛徽章:
0
5 [报告]
发表于 2007-02-13 22:51 |只看该作者
-i[ReplaceString]          Obsolete flag. Use the -I (Uppercase i) flag.

If you do not specify the ReplaceString parameter, the string "{}" is used.

    Note: The -I (Uppercase i), and the -i flags are mutually exclusive; the last flag specified takes effect.

-I ReplaceString         (Uppercase i). Inserts each line of standard input as an argument for the Command parameter, inserting it in Argument for each occurrence of ReplaceString. ReplaceStrings can not be used in more than 5 arguments. Blank characters at the beginning of each standard input line are ignored. Each Argument can contain one or more ReplaceStrings, but may not be larger than 255 bytes. The -I flag also turns on the -x flag.

    Note: The -I (Uppercase i), and the -i flags are mutually exclusive; the last flag specified takes effect.

--replace[=replace-str], -I replace-str, -i[replace-str]
              Replace occurences of replace-str in the initial arguments with names read
              from standard input.  Also, unquoted blanks do  not  terminate  arguments.
              If  replace-str  is  omitted, it defaults to "{}"

在这里不用都行吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP