English 中文(简体)
设法从位于贾瓦的reg雷克的伐木档案中获取一些有用的数据
原标题:Trying to get some useful data from a log file with regex in Java

我感到困惑,因为我只能达到我的一些目标。

我有一份记录文件,我必须与其中一些项目相匹配,并撰写另外一份标记文件。 我写了一份 Java法,作为我守则的一个简短例子,但当我提出整个档案时,所有东西都得到了信息。

*052511 074217 0065            02242806000      UNKNOWN         U G

*052511 074217 0065    4874    02242806000      UNKNOWN         U A

*052511 074218 0065    4874    02242806000      UNKNOWN         U R

--------   05/25/11   07:42:17   LINE = 0065   STN = 4874    

   CALLING NUMBER   02242806000

   NAME             UNKNOWN        

   UNKNOWN

   BC = SPEECH

00:00:00   INCOMING CALL    RINGING 0:02

00:00:11   CALL RELEASED

我不得不从档案中找到这些结果:

开放:42:17,0065,4874,02242806000,00:09,2

00:00:00:09。

对于每一个即将发出和即将发出的呼吁,我必须进行上述对话。

问题回答

您可使用以下简称:

(?xm:
^-------- s+ (S+) s+ (S+) s+ LINEs*=s*(d+) s+ STNs*=s*(d+)
s+ CALLING NUMBER s+ (d+) s*
(?:^(?:[ 	]+.*)?[

]+)* # eat unwanted part

^(dd:dd:dd) s+ INCOMING CALL s+ RINGING ([d:]+) s*
(?:^d.*[
]+)* # possible stuff
^(dd:dd:dd) s+ CALL RELEASED
)

利用捕捉团体的价值观取得结果。 您可能需要删除<代码>/x等相关内容,如评论和空间。

Perl example at





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签