从R中的原始.log文件中提取一个部分

时间:2016-09-27 13:41:39

标签: r logfile

我有一个由java程序创建的日志文件。该文件如下所示:

26-Sep-2016 09:15:09:292, INFO, connection [driver1-1] created
[client: driver1-1 - ClassServer] Attempting connection to the class server at XXXX:11111
26-Sep-2016 09:15:09:301, INFO, [client: driver1-1 - ClassServer] Attempting  connection to the class server at XXXX:11111
26-Sep-2016 09:15:18:486, INFO,     1554 tasks completed.
26-Sep-2016 09:15:18:488, INFO, 
26-Sep-2016 09:15:18:488, INFO, 
26-Sep-2016 09:15:18:488, INFO, Arrangement Model tasks:
26-Sep-2016 09:15:18:490, INFO, done with Arrangement Model.
26-Sep-2016 09:15:19:529, INFO, 
26-Sep-2016 09:15:19:529, INFO, 
26-Sep-2016 09:15:19:529, INFO, 
26-Sep-2016 09:15:19:529, INFO, Job Types by Area
26-Sep-2016 09:15:19:529, INFO, 
26-Sep-2016 09:15:19:530, INFO, 
26-Sep-2016 09:15:19:530, INFO, Area               Full-time      
26-Sep-2016 09:15:19:530, INFO, ---------------------------------
26-Sep-2016 09:15:19:531, INFO, 1:  Area1                  49050         
26-Sep-2016 09:15:19:531, INFO, 2:  Area2                  31107        
26-Sep-2016 09:15:19:531, INFO, 3:  Area3                  220020 
26-Sep-2016 09:15:19:531, INFO, 4:  Area4                  2079 
26-Sep-2016 09:15:19:531, INFO, ----------------------------------
26-Sep-2016 09:15:19:531, INFO, Total                      302256
26-Sep-2016 09:15:19:532, INFO, 
26-Sep-2016 09:15:19:532, INFO, 
26-Sep-2016 09:15:19:532, INFO, 
26-Sep-2016 09:15:19:532, INFO, Employment Types by Area   

我想从文本文件中提取以下部分。

26-Sep-2016 09:15:19:529, INFO, Job Types by Area
26-Sep-2016 09:15:19:529, INFO, 
26-Sep-2016 09:15:19:530, INFO, 
26-Sep-2016 09:15:19:530, INFO, Area               Full-time      
26-Sep-2016 09:15:19:530, INFO, ---------------------------------
26-Sep-2016 09:15:19:531, INFO, 1:  Area1                  49050         
26-Sep-2016 09:15:19:531, INFO, 2:  Area2                  31107        
26-Sep-2016 09:15:19:531, INFO, 3:  Area3                  220020 
26-Sep-2016 09:15:19:531, INFO, 4:  Area4                  2079 
26-Sep-2016 09:15:19:531, INFO, ----------------------------------
26-Sep-2016 09:15:19:531, INFO, Total                      302256 

我尝试使用grep来做,但我没有成功。从这样的日志文件中提取的最有效方法是什么?

0 个答案:

没有答案