find pwd grep cp xargs组合
2009-03-28 20:50
357 查看
[linux@/etc]# find `pwd`|grep 'conf$'|xargs -i cp {} /home/
这条命令会复制所有/etc及其子录下的最后的文件名为conf的文件到/home/目录下
注意:这个命令在Red Hat 9下通过 -i的意思用man xargs得如下内容:
--replace[=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
"{}" (like for `find -exec'). Implies -x and -l 1.
至于{}代表cp这个命令的第一个参数
[linux@/home]# pwd |xargs -i cp /etc/syslog.conf {}
上面这条命令会复制etc目录下的syslog.conf到当前目录下 {}这对括号表示的是cp的第二个参数,他的值由前面的pwd命令取得,并由xargs命令传给cp
这条命令会复制所有/etc及其子录下的最后的文件名为conf的文件到/home/目录下
注意:这个命令在Red Hat 9下通过 -i的意思用man xargs得如下内容:
--replace[=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
"{}" (like for `find -exec'). Implies -x and -l 1.
至于{}代表cp这个命令的第一个参数
[linux@/home]# pwd |xargs -i cp /etc/syslog.conf {}
上面这条命令会复制etc目录下的syslog.conf到当前目录下 {}这对括号表示的是cp的第二个参数,他的值由前面的pwd命令取得,并由xargs命令传给cp
相关文章推荐
- grep、 sed、 find 、xargs、 gawk 输入输出,好用不好学的东西
- Linux常用命令-1---cd、ls、grep、find、cp
- 查找并复制(find,xargs,cp)
- find与grep的组合使用
- linux中强大且常用命令:find、xargs、grep
- find grep xargs 查找某目录下包含某字符串的文件
- linux中强大且常用命令:find、xargs、grep
- linux find grep组合使用
- find grep组合使用查找文件
- shell——cat,find,xargs,tr,sort,grep
- linux查找技巧: find grep xargs
- SHELL学习之二--(转 grep sed find xargs gawk 输入 等操作)
- find grep xargs 文件的操作
- find grep组合使用查找文件
- find与grep的组合使用
- linux(5)--补充(管道| / 重定向> / xargs)/find 与xargs结合使用/vi,grep,sed,awk(支持正则表达式的工具程序)
- grep命令参数列表过长?我们还有find、xargs和grep
- linux查找技巧: find grep xargs
- linux中 find grep组合使用示例
- find grep xargs 命令详解