ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle Linux xargs Command

Oracle Linux xargs Command

原创 Linux操作系统 作者:chncaesar 时间:2013-11-25 22:54:11 0 删除 编辑
This manual page documents the GNU version of xargs.  xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by items read from standard input.  Blank lines on the standard input are ignored.

-p Prompt the user about whether to run each command line and read a line from the terminal. 
-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.


Examples:
List all *.dat files in the current directory and zip each file.
ls *.dat | xargs -I {} zip ./{}.zip {}

Generates a compact listing of all the users on the system.
cut -d: -f1 < /etc/passwd | sort | xargs echo

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/638844/viewspace-1061075/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-07-30

  • 博文量
    102
  • 访问量
    926321