linux - 缺少统计操作数

标签 linux xargs stat

我正在尝试将 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/

相关文章:

linux - bash:在 stdout 上触发输出

linux - 如何批处理 sed 文件和重定向结果

python-3.x - Python3 : Recursively compare two directories based on file contents

linux - Dir 指针,通过 stat 访问目录和文件信息

linux - xargs(或其他东西)参数前没有空格

c++ - 为什么没有目录时S_ISDIR()指示目录?

c - 在linux中拦截执行的命令

linux - sed:如何删除与包含正斜杠的模式匹配的行?

linux - 共享主机中的 Subversion 结账?

bash - 使用 xargs 显示 git 别名中的命令