From f290a90465543e4bf0e6b038259e9463802b21ec Mon Sep 17 00:00:00 2001 From: jxu <7989982+jxu@users.noreply.github.com> Date: Fri, 2 Aug 2024 04:01:37 -0400 Subject: [PATCH] xargs: add -n1 example (#13340) Co-authored-by: spageektti --- pages/common/xargs.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pages/common/xargs.md b/pages/common/xargs.md index c3aeaf754..3e805c51a 100644 --- a/pages/common/xargs.md +++ b/pages/common/xargs.md @@ -16,6 +16,10 @@ `find . -name '*.backup' -print0 | xargs -0 rm -v` +- Execute the command once per argument: + +`{{arguments_source}} | xargs -n1 {{command}}` + - Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line: `{{arguments_source}} | xargs -I _ {{command}} _ {{optional_extra_arguments}}`