我正在尝试逐行读取特定字符串及其值的日志文件。
例如,我有一个如下的日志文件:
####<Sep 26, 2013 12:05:22 AM MDT> <Error> <comApp> <ap001> <Server12> <[ACTIVE] ExecuteThread: '55' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1380175522589> <000000> <<ERROR>Exception ID: 971 - Rate with ResParameters-> MAT: SJC GHT: FJC PUD: Fri Sep 27 09:00:00 MDT 2013>
####<Sep 26, 2013 12:05:22 AM MDT> <Error> <comApp> <ap001> <Server12> <[ACTIVE] ExecuteThread: '55' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1380175522593> <000000> <<ERROR>Exception ID: 971 - Rate with ResParameters-> MAT: SJC GHT: FJC PUD: Fri Sep 27 09:00:00 MDT 2013>
####<Sep 26, 2013 12:05:22 AM MDT> <> <Error> <comApp> <ap001> <Server12> <[ACTIVE] ExecuteThread: '55' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1380175522597> <000000> <<ERROR>Exception ID: 971 - Rate with ResParameters-> MAT: SJC GHT: FJC PUD: Fri Sep 27 09:00:00 MDT 2013>
我需要从定义的字符串 MAT:、GHT:、PUD 中读取值:
我想要得到的输出是:
SJC , FJC, Fri Sep 27 09:00:00 MDT 2013
DJA , SJC, Fri Sep 27 09:00:00 MDT 2013
FJC , KJC, Fri Sep 27 09:00:00 MDT 2013
JJC , SJC, Fri Sep 27 09:00:00 MDT 2013