9 ms·
For tools that don't support -0, you can add the NULs yourself without much fuss. It's a one-liner in awk/perl/sed. Very handy.
by jsrcout 2mo ago
For tools that don't support -0, you can add the NULs yourself without much fuss. It's a one-liner in awk/perl/sed. Very handy.
- ykonstant 2mo agoIf you do not have -0 options in your xargs/find, I wonder if you will have those extensions in your awk/sed. Perl is a different story.
- MrDOS 2mo agoI think the parent was referring to using awk/sed to do the equivalent of: find ... | tr '\n' '\0' | xargs -0 ... I.e., a blind replacement without the tool having any particular semantic understanding of what it's translating. That still requires your xargs to have -0 support, though, and I'd be surprised to have that without the corresponding option on find. But I've done this before when feeding xargs from something other than find.
- mr_mitm 2mo agoIt is also built on the assumption that filenames never contain newlines, which is wrong in general. It's baffling to me that POSIX allows non-printable characters in file names, but here we are. Surely they had a reason for this decision.
- db48x 2mo agoThat’s changing, maybe eventually even on real systems: https://blog.toast.cafe/posix2024-xcu#the-nuclear-option https://blog.toast.cafe/posix2024-xcu#the-nuclear-option