mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-02 00:35:23 +02:00
xargs: Show delimiter flag usage (#2111)
This commit is contained in:
parent
d09a09865d
commit
4e75d18be2
1 changed files with 2 additions and 6 deletions
|
@ -7,13 +7,9 @@
|
||||||
|
|
||||||
`{{arguments_source}} | xargs {{command}}`
|
`{{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`
|
`find . -name {{'*.backup'}} -print0 | xargs -0 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}}`
|
|
||||||
|
|
||||||
- Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line:
|
- Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue