我试图为目录中的每个文件(至少包含以下字段的行)获取以下字段(顺序并不重要,尽管该顺序更可取):
- Image resolution, in case it is an image. If not, just blank.
- Modification date
- Human readable file size
- Filename目录中的文件是jpg图像,其余的只是纯文本文件。我试过这样的方法:
find . -type f -exec paste `identify {} 2> /dev/null` `ls -goh {}` \;ls告诉我cannot access {}。2> /dev/null部件在identify中用于跳过非jpg文件的错误消息。
我也尝试过xargs和$()等的不同组合,但还没有找到一种方法。
有什么建议吗?
发布于 2018-09-21 17:46:44
在查找甚至开始之前,将对替换中的文本进行一次评估。注意,现在首选的方法是$( )。您可以将引用的命令传递给shell,但最简单的方法是创建脚本并从find调用脚本。
https://unix.stackexchange.com/questions/470594
复制相似问题