🐷

findした結果をxargsで展開できない

2023/07/12に公開

fineした結果をループ処理しようとしたら一部replstrが展開されず。

なんでかなぁと思ったら
<a href="https://blog.ottijp.com/2020/07/12/xargs255/">xargsが255byteまでしか展開できない | ottijp blog</a>

ということらしく

Macのxargsの-Iオプションに潜む罠 - Qiita

複数の場合は合算されるらしい。

macだけの仕様らしい。

man xargsから抜粋。

     -I replstr
             Execute utility for each input line, replacing one or more
             occurrences of replstr in up to replacements (or 5 if no -R flag
             is specified) arguments to utility with the entire line of input.
             The resulting arguments, after replacement is done, will not be
             allowed to grow beyond replsize (or 255 if no -S flag is
             specified) bytes; this is implemented by concatenating as much of
             the argument containing replstr as possible, to the constructed
             arguments to utility, up to replsize bytes.  The size limit does
             not apply to arguments to utility which do not contain replstr,
             and furthermore, no replacement will be done on utility itself.
             Implies -x.

Discussion