我需要从日志中匹配并提取带有 pattern1 的行,该行应该位于另一个 pattern2 匹配行之后:例如,日志具有如下数据:
00:00:01 Computing CDA.
00:01:10 Trying to open errorLog1.
00:01:12 writing errorLog1.
00:01:13 Trying to open outLog1.
00:01:14 writing outLog1.
00:01:15 Processing Complete!
00:01:16 Validating documents.
00:02:14 Trying to open errorLog2.
00:02:12 writing errorLog2.
00:02:13 Trying to open outLog2.
00:02:14 writing outLog2.
00:02:15 Processing Complete!
我需要计算文档验证所需的时间(第一列)。所以我想用“Validating document”字符串和“Processing Complete”字符串检索行来提取时间并得到差异。这可能很容易,但我无法找出解决方案。