Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在执行这个 grep: grep -l "Validation failed" *.dbg
这将返回一个文件列表。但是,我最感兴趣的是这些文件的修改时间。
正确的命令是什么?
编辑:标题中的论点是错误的。
xargs 显然是我的朋友。答案是:grep -l "Validation failed" *.dbg | xargs ls -ltr
你也可以这样做
for file in `grep -l "Validation failed" *.dbg`; do ls -ltr $file; done
但是 xargs 绝对更简洁、更短,并且为您提供了简单的分隔符选项。