Skip to content

Instantly share code, notes, and snippets.

@cj3kim
Created August 24, 2015 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cj3kim/7ef2e59d2ae83cf27112 to your computer and use it in GitHub Desktop.
Save cj3kim/7ef2e59d2ae83cf27112 to your computer and use it in GitHub Desktop.
XARGS(1) BSD General Commands Manual XARGS(1)
NAME
xargs -- construct argument list(s) and execute utility
SYNOPSIS
xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr] [-L number] [-n number [-x]]
[-P maxprocs] [-s size] [utility [argument ...]]
-J replstr
If this option is specified, xargs will use the data read from standard input to replace
the first occurrence of replstr instead of appending that data after all other arguments.
This option will not affect how many arguments will be read from input (-n), or the size
of the command(s) xargs will generate (-s). The option just moves where those arguments
will be placed in the command(s) that are executed. The replstr must show up as a dis-
tinct argument to xargs. It will not be recognized if, for instance, it is in the middle
of a quoted string. Furthermore, only the first occurrence of the replstr will be
replaced. For example, the following command will copy the list of files and directories
which start with an uppercase letter in the current directory to destdir:
/bin/ls -1d [A-Z]* | xargs -J % cp -rp % destdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment