下面是代码示例,这是一个很长的日志,但我刚刚粘贴了一段代码。 我需要提取模式之间的行------------------并分别将每个行的每个信息存储在单独的文本文件中
Like:
------------------
info1
------------------
info2
------------------
info3
------------------
输出:
fetch info1 and store it into file1.txt
fetch info2 and store it into file2.txt
fetch info3 and store it into file3.txt
And so on...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
**This is the text data :**
------------------------------------------------------------------------
revision88 106 | rohit | 2018-06-08 13:41:46 +0530 (Fri, 08 Jun 2018) | 1 line
initial code import from FinanavialAnalytics branch
------------------------------------------------------------------------
revision88 99 | dhammdip.sawate | 2018-06-04 20:59:48 +0530 (Mon, 04 Jun 2018) | 1 line
Added Little Bit Java Support.!
Index: resources.properties
===================================================================
--- resources.properties (revision 98)
+++ resources.properties (revision 99)
@@ -1,15 +1,15 @@
####################Elastsic Search#########################
ElasticClusterName=UProbe
-ElasticHost=192.168.0.91
+ElasticHost=192.168.0.73
ElasticPort=19300
-esSQLURL=http://192.168.0.91:19200/_sql?sql=
+esSQLURL=http://192.168.0.73:19200/_sql?sql=
resultsize =1024
@@ -72,45 +72,65 @@
secfile /home/sandeep/Desktop/LIC/Uprobe-LIC/Uprobe-Dev.seed
licfile /home/sandeep/Desktop/LIC/Uprobe-LIC/Uprobe-Dev.lic
------------------------------------------------------------------------
revision88 | sandeep.yadav | 2018-05-31 15:31:26 +0530 (Thu, 31 May 2018) | 1 line
Acc_Ref Data front-end side functionality with validation done.
------------------------------------------------------------------------
试试这个:
甚至不用正则表达式也可以做到这一点
我假设,主文本文件位于名为“text.txt”的同一目录中,并且您希望将文件保存在同一目录中。请根据您的需要更改文件路径。这应该适用于您:
如果日志文件不太大(例如1GB),则可以使用以下工具执行此操作:
相关问题 更多 >
编程相关推荐