From deb4619a79deace26923e91a93b6d7bbfce40e78 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sun, 17 Nov 2024 00:01:08 +0100 Subject: xargs: initial notes --- src/cli/xargs.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/cli/xargs.md (limited to 'src/cli/xargs.md') diff --git a/src/cli/xargs.md b/src/cli/xargs.md new file mode 100644 index 0000000..a6f3c8c --- /dev/null +++ b/src/cli/xargs.md @@ -0,0 +1,23 @@ +# xargs(1) + +``` +xargs [opts] [cmd [init-args]] + -l [] maximal number of lines per cmd invocation + if it not provided, num=1 is assumed + -I replace 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 +``` \ No newline at end of file -- cgit v1.2.3