我正在尝试将 stat 与 xargs 结合使用,但我从 stat 收到错误,指出我缺少操作数。
下面是我正在使用的整个命令
find /my/path/Files_G** -type f | xargs stat --format='%s, %n' > my_output.txt\r
感谢您提供的任何帮助
最佳答案
尝试以下任一方法:
find ... -type f | xargs -n 1 stat --format='%s, %n'
find ... -type f | xargs -I '{}' stat --format='%s, %n' '{}'
或者在大多数 UN*X 系统上:
find ... -type f | xargs -i stat --format='%s, %n' '{}'
(-i
是标准 -I '{}'
的简写)
参见xargs(1) OpenGroup 标准联机帮助页提供更详细的解释...
关于linux - 缺少统计操作数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17084565/