xargs  -i 参数或者-I参数配合{}即可进行文件的操作。
 
-I replace-str
              Replace  occurrences  of  replace-str  in the initial-arguments with names read from standard input.  Also, unquoted blanks do not terminate
              input items; instead the separator is the newline character.  Implies -x and -L 1.

       --replace[=replace-str], -i[replace-str]
              This option is a synonym for -Ireplace-str if replace-str is specified, and for -I{} otherwise.  This option is deprecated; use -I  instead.
man了一下看的还是不太懂,通过例子,做作实验将我的理解写一下。
 
############### 操作的目录下的文件###############
[root@test05 ab]# ls
1kk.zip  3kk.zip  5kk.zip  b.rar  d.rar  f.rar  h.rar  j.rar  mini.txt  ni.txt
2kk.zip  4kk.zip  a.rar    c.rar  e.rar  g.rar  i.rar  k.rar  nii.txt
###################使用 i 参数 ##################
[root@test05 ab]# find . -type f -name "*.txt" | xargs -i cp {}  /tmp/k/
[root@test05 ab]# ls ../k/
mini.txt  nii.txt  ni.txt
[root@test05 ab]#
###################  使用 I  参数 ################
[root@test05 ab]# find . -type f -name "*.txt" | xargs -I {} cp {}  /tmp/n/
[root@test05 ab]# ls ../n/
mini.txt  nii.txt  ni.txt
 
结果出来了,
  加-i 参数直接用 {}就能代替管道之前的标准输出的内容;

xargs -I的更多相关文章

  1. 每天一个 Linux 命令(21):find命令之xargs

    在使用 find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行.但有些系统对能够传递给exec的命令长度有限制,这样在find命令运行几分钟之后,就会出 ...

  2. [Linux] xargs 和 管道符的区别

    今天刚好遇到需要使用xargs的情况,就来研究一下xargs 和 管道符的区别 举几个例子,下面两个语句执行后的结果是什么呢? 1. zhang$ find . -name "*.prope ...

  3. find / -type f -name "*fetion*" |xargs rm -rf {}\

    find / -type f -name "*fetion*" |xargs rm -rf {}\

  4. linux命令:xargs

    1.命令介绍: xargs用来配合find命令查找的结果然后执行相应的命令 2.命令格式: find -type f -print | xargs file

  5. xargs的原理剖析及用法详解

    转载请注明出处:http://www.cnblogs.com/f-ck-need-u/p/5925923.html 学习这个xargs花了很长时间,在网上翻了很久也查了很多书关于xargs的介绍,都只 ...

  6. [Linux] xargs

    xargs 命令可以将一个命令的输出,作为另一个命令的输入! 这里听来好像是管道的功能,之所以有xargs是因为有的命令不知吃管道,这时xargs就派上用场了! 具体的方法是:前一个命令的输出会使用空 ...

  7. 【转】Linux中xargs的用法

    xargs大 多数 Linux 命令都会产生输出:文件列表.字符串列表等.但如果要使用其他某个命令并将前一个命令的输出作为参数该怎么办?例如,file 命令显示文件类型(可执行文件.ascii 文本等 ...

  8. Linux xargs将输出数据流转换成命令参数

    200 ? "200px" : this.width)!important;} --> 介绍 我们可以利用管道将一个命令的“标准输出”作为另一个命令的“标准输入”:但是这里的 ...

  9. 每天一个linux命令(21):find命令之xargs

    在使用 find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行.但有些系统对能够传递给exec的命令长度有限制,这样在find命令运行几分钟之后,就会出 ...

随机推荐

  1. C++ 的二进制语法与语义

    /* 转载请注明出处:http://www.cnblogs.com/Martinium/p/binary_literal.html */ 二进制的语法 C/C++ 默认数字使用十进制,八进制使用前缀 ...

  2. winform TreeView的一些用法以及异步加载

    今天,主要弄了一下对于树型控件的一些方法,以及异步加载.参考: http://www.cnblogs.com/greatverve/archive/2012/03/23/winform-treevie ...

  3. hdu 5071(2014鞍山现场赛B题,大模拟)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5071 思路:模拟题,没啥可说的,移动的时候需要注意top的变化. #include <iostr ...

  4. TTrayIcon用法

    TTrayIcon用法 self.trycn1.Icon:=Application.Icon; Self.trycn1.Hint:=self.Caption; self.trycn1.Visible: ...

  5. 读写注册表 registrykey 创建删除

    namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { Initialize ...

  6. iOS--UIScrollView图片动画切换【实现每次只加载3张图片,进而减少占用内存,可循环滚动】

    #import "ViewController.h" #define IMAGENUMBER 5 #define SIZE self.view.bounds.size @inter ...

  7. Leetcode Trapping Rain Water

    Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...

  8. 关于Openlayer3的菜鸟认识

    什么是OpenLayers? OpenLayers 是一个专为Web GIS 客户端开发提供的JavaScript 类库包,用于实现标准格式发布的地图数据访问.从OpenLayers2.2版本以后,O ...

  9. linux系统中批量查找文件与文件内容的方法

    在linux中查看与修改文件权限我们都必须使用命令来操作,不能像windows一样点几下就好了,下面我们简单的介绍一下linux中的相关命令 比如查找当前目录下面所有的php文件里面某个关键字 fin ...

  10. SharedPreferences介绍,用来做数据存储

    sharedPreferences是通过xml文件来做数据存储的. 一般用来存放一些标记性的数据,一些设置信息. *********使用sharedPreferences存储数据 public sta ...