xargs: Show delimiter flag usage (#2111)

italian
okaymaged 2018-05-18 13:22:49 -07:00 committed by Starbeamrainbowlabs
parent d09a09865d
commit 4e75d18be2
1 changed files with 2 additions and 6 deletions

View File

@ -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: