【发布时间】:2014-02-03 07:40:25
【问题描述】:
在一个简单的情况下,假设我们有一些标准错误:
$ ls /fake/file
ls: /fake/file: No such file or directory
问题:是否可以从标准错误中解析出“/fake/file”而无需先将其写入文件?例如:
$ ls /fake/file 2> tmp.file; sed 's/.* \(.*\):.*/\1/' tmp.file
/fake/file
【问题讨论】:
-
这里描述了很多方法:stackoverflow.com/questions/2342826/…