![从日志文件中提取信息进行聚合](https://linux22.com/image/498333/%E4%BB%8E%E6%97%A5%E5%BF%97%E6%96%87%E4%BB%B6%E4%B8%AD%E6%8F%90%E5%8F%96%E4%BF%A1%E6%81%AF%E8%BF%9B%E8%A1%8C%E8%81%9A%E5%90%88.png)
给定以下格式的日志
2009-11-11 13:13:44,716 INFO Something happened : problem description . Waited 3 seconds
2009-11-11 13:23:44,716 INFO Something happened : problem description . Waited 1 second
2009-11-11 13:33:44,716 INFO Something happened : some other problem description .
:
我怎样才能提取和之间的字符串.
?
答案1
或许:
<logfile sed -e"s/^.* : \(.*\) \..*/\1/"
答案2
cat logfile | cut -f1 -d. | cut -f4 -d: