- 帖子
- 2
- 积分
- 14
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2017-1-16
|
[文本处理] 批处理抓取log文件内容,看到关键字放入新文件
想用BATCH去实时读取一个LOG文件,LOG文件内容如下:
2017-01-13 05:56:46.751 INFO [CoagentReportReceiver:26:receive][pool-39-thread-
1] - 接收到状态报告入状态报告队列,totalLength = 63 commandID = 7 sequenceId = 22
4132 commandStatus = 32 destmobile = xxxxxxxxxxx Stat = 2 ErrorCode = IC:00006 S
rcSequenceId = 9128701091547334700 PkNumber = 1
2017-01-13 05:56:46.751 INFO [CoagentReportReceiver:26:receive][pool-39-thread-
1] - 接收到状态报告入状态报告队列,totalLength = 63 commandID = 7 sequenceId = 22
3890 commandStatus = 32 destmobile = xxxxxxxxxxx Stat = 2 ErrorCode = IC:00006 S
rcSequenceId = 9128701091547294556 PkNumber = 1
2017-01-13 05:56:46.751 INFO [CoagentReportReceiver:26:receive][pool-39-thread-
1] - 接收到状态报告入状态报告队列,totalLength = 63 commandID = 7 sequenceId = 22
4154 commandStatus = 32 destmobile = xxxxxxxxxxx Stat = 2 ErrorCode = IC:00006 S
rcSequenceId = 9128701091547354769 PkNumber = 4
我想实现:1、LOG文件是某个系统的日志文件,会持续地扩大,所以这个BATCH也需要一直保持运行;2、如发现某条记录中有ErrorCode =IC:00006,需要把整条记录放入一个新的txt文件,叫error.log;3、记录和记录之间使用回车间隔的。
想问下各位大神能否实现?或者提供下思路,谢谢! |
|