3 ms·
You can easily compose this with `xargs` using the`-0 / --print0` option: fd -0 '\.log$' | xargs -0 tail
by jitl 9y ago
You can easily compose this with `xargs` using the`-0 / --print0` option:
fd -0 '\.log$' | xargs -0 tail
- tyingq 9y agoxargs does have limits on input length. On some platforms they aren't terribly high. Sound like -exec is potentially coming though. Edit: Swore I had gotten ARG_MAX complaints out of xargs in the past. Replies are correct though. I'm wrong here...xargs adjusts on the fly. Perhaps long ago, or some obscure use of xargs?
- Hello71 9y ago> xargs does have limits on input length what?
- btashton 9y agoYeah they can be as low as 4096 bytes. `xargs --show-limits`
- sitharus 9y agoSome versions of xargs don't respect the shell's max argument length, so on older platforms (MacOS X 10.4 sticks out in my memory) it's easy to cause xargs to try invoking with a longer command line than permitted. This is fixed with the `-n` argument to xargs, which lets you specify the number of arguments per invocation.
- derriz 9y agoWhy is this a problem? Except in terms of performance, it's completely invisible to the user as xargs will run the command multiple times to ensure all the arguments are processed. In the most extreme/unrealistic case, if xargs could only support invoking the command with a single arguement, then the performance would regress to that of using -exec. Otherwise it's much faster.