in reply to yargs -- xargs but handle spaces in filenames
I have never run into a case where somebody thought it was reasonable to include a newline in a filename.
Alas, I have run into a few cases where someone managed to include a newline in a filename without intending to. It happens.
For example, "find ... -print0 | grep ... | sed ... | xargs -0 ..." isn't likely to work properly.
But something like this is likely to work just fine:
In fact, I think that's better overall as a general solution for this sort of problem.find ... -print0 | perl -0 -lne 'if(m{...}){s{..}{..};print}' | xarg +s -0 ...
(updated snippet to avoid using "/" as a regex delimiter, since "/" would often be used in the regex)
|
|---|