我有一个从 PLC 转储的每日日志文件,示例文本是(它没有标题,只有原始数据):
5/29/2009 3:05:33 PM: PLC Requested Hand Scan
5/29/2009 3:05:40 PM: HH Label Data Retrieved: 078797312
5/29/2009 3:05:40 PM: PLC Requested Scale Weight
5/29/2009 3:05:40 PM: Scale Data Retrieved: 56.0
5/29/2009 3:05:40 PM: ProcessMOSData Loop: 1
5/29/2009 3:05:40 PM: About to read
5/29/2009 3:05:40 PM: Read: False
5/29/2009 3:05:40 PM: ProcessMOSData Loop: 2
5/29/2009 3:05:40 PM: About to read
5/29/2009 3:05:40 PM: Read: True
5/29/2009 3:05:40 PM: Found Bin02
5/29/2009 3:05:40 PM: ProcessMOSData Loop: 3
5/29/2009 3:05:40 PM: About to read
5/29/2009 3:05:40 PM: Read: False
5/29/2009 3:05:40 PM: ProcessMOSData Loop: 4
5/29/2009 3:05:40 PM: About to read
5/29/2009 3:05:40 PM: Read: False
5/29/2009 3:05:40 PM: ProcessMOSData Loop: 5
5/29/2009 3:05:40 PM: About to read
5/29/2009 3:05:41 PM: Read: False
5/29/2009 3:05:41 PM: ProcessMOSData Loop: 6
5/29/2009 3:05:41 PM: About to read
5/29/2009 3:05:41 PM: Read: False
5/29/2009 3:05:41 PM: ProcessMOSData Loop: 7
5/29/2009 3:05:41 PM: About to read
5/29/2009 3:05:41 PM: Read: False
5/29/2009 3:05:41 PM: ProcessMOSData Loop: 8
5/29/2009 3:05:41 PM: About to read
5/29/2009 3:05:41 PM: Read: False
5/29/2009 3:05:41 PM: ProcessMOSData Loop: 9
5/29/2009 3:05:41 PM: About to read
5/29/2009 3:05:41 PM: Read: False
5/29/2009 3:05:41 PM: Got all data
5/29/2009 3:05:41 PM: Wrote good label ack
我有 15 个“关键短语”要数一数。我有 1150 个文本文件,我可能会将它们组合成一个大文本文件,然后在初始读取后将其读取并转储到新表中。它可以输出到 csv 或 sql,并不重要。最后一部分将只是监控流程变更的改进如何提高该领域的效率。
例如,其中一个关键短语是“PLC 请求手部扫描”,因此在示例中它将有 2009 年 5 月 29 日 1 次。我在想顶部的标题将是关键短语,而左侧将是不同的日子。这似乎是 logparser 可以做的事情,但是如果没有标题并且每一行只是一个长字符串,我不知道如何开始。