-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
- [tac](./tac.md) | ||
- [rev](./rev.md) | ||
- [paste](./paste.md) | ||
- [xargs](./xargs.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# xargs(1) | ||
|
||
``` | ||
xargs [opts] [cmd [init-args]] | ||
-l [<num>] maximal number of lines per cmd invocation | ||
if <num> it not provided, num=1 is assumed | ||
-I <str> replace <str> in the [init-args] with the arg; | ||
this implies -l, and hence processes one arg at a time | ||
``` | ||
|
||
## Example | ||
|
||
Collect arguments and prefix them with another option. | ||
```sh | ||
# Using -l to process one arg at a time. | ||
eval strace -f (find /dev -name 'std*' | xargs -l echo -P | xargs) ls | ||
|
||
# Using -I to place the arg at the specified location. | ||
eval strace -f (find /dev -name 'std*' | xargs -I {} echo -P {}) ls | ||
|
||
# Both commands achieve the same thing and result in something like: | ||
# eval strace -f -P /dev/stdin -P /dev/stdout -P /dev/stderr ls | ||
``` |