xargs
Important flags1:
flag | description |
---|---|
-d |
algorithm for white space splitting |
-P |
run invocations in parallel |
-n |
how many arguments to pass the process |
For whitespace splitting a couple options:
flag | description |
---|---|
(default) | split on words |
-d $'\n' |
split on lines |
-0 |
unsafe data (null tokens) |
- An Opinionated Guide to xargs
- Will trim white space when provided no arguments
Interpolate value
# place argument somewhere besides the end
xargs -I{} cp {} ./dest
macOS Specific
Delimit by line
OUTPUT | tr '\n' '\0' | xargs -0 -n 1 -- echo "HELLO"