从日志文件中提取信息进行聚合

从日志文件中提取信息进行聚合

给定以下格式的日志

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:

相关内容