From 4e75d18be2288b285ca87d3c6cae6fdeaaf0db39 Mon Sep 17 00:00:00 2001 From: okaymaged <3887838+okaymaged@users.noreply.github.com> Date: Fri, 18 May 2018 13:22:49 -0700 Subject: [PATCH] xargs: Show delimiter flag usage (#2111) --- pages/common/xargs.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pages/common/xargs.md b/pages/common/xargs.md index 84af21ec40..d3a1f8466b 100644 --- a/pages/common/xargs.md +++ b/pages/common/xargs.md @@ -7,13 +7,9 @@ `{{arguments_source}} | xargs {{command}}` -- Delete all files with a `.backup` extension: +- Delete all files with a `.backup` extension. `-print0` on find uses a null character to split the files, and `-0` changes the delimiter to the null character (useful if there's whitespace in filenames): -`find . -name {{'*.backup'}} | xargs rm -v` - -- Convert newlines in the input into NUL (`\0`) characters, and split on those only (useful if the input to xargs contains spaces): - -`{{arguments_source}} | tr '\n' '\0' | xargs -0 {{command}}` +`find . -name {{'*.backup'}} -print0 | xargs -0 rm -v` - Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line: