xargs
, command,
Syntax
command | xargs [options] [command]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
-I {} |
, | |
Common |
-n |
N Parameters | |
Common |
-P |
|
Common | |
-d |
|
Common | |
-0 |
null ( find -print0) | |
Common |
-t |
command() | |
Common |
Examples
.log
find . -name '*.log' | xargs rm
find . -name '*.js' -print0 | xargs -0 grep 'TODO'
URL
cat urls.txt | xargs -I {} curl -s {}4
find . -name '*.png' | xargs -P 4 -I {} convert {} -resize 50% {}docker ps -q | xargs docker stop
Tips
- find -print0 | xargs -0
- -P Parameters,
- -I {} command
- xargs, -d '\n'