File parsing java

R

raj

Hi,
I have text file which contains data in this way

DEBUG ooegroup.OoeGroupOnlineInterfaceImpl - PERFORMANCE
MEASUREMENT :: BEFORE OOE RESERVE GROUP MEMBER Info >>>> Fri Apr 03
10:16:47 ICT 2009>
DEBUG ooegroup.OoeGroupOnlineInterfaceImpl - reserveOOEGroup :>
DEBUG ooegroup.OoeGroupOnlineInterfaceImpl - PERFORMANCE
MEASUREMENT :: AFTER OOE RESERVE GROUP MEMBER Info >>>> Fri Apr 03
10:16:48 ICT 2009>
DEBUG reserve.ReserveOoeGroupResponseMapper - Start :
mapToOOEGroupResponse>


each line starts with DEBUG

i need to read this text and take the strings which contains
PERFORMANCE MEASUREMENT and split this

PERFORMANCE MEASUREMENT :: BEFORE OOE RESERVE GROUP MEMBER Info >>>>
Fri Apr 03 10:16:47 ICT 2009>

into 1) BEFORE
2) OOE RESERVE GROUP MEMBER Info and 3) Fri Apr 03 10:16:47 ICT 2009

i mean to say into 3 tokens .

i have done upto this part

lineText = lnr.readLine();
while (lineText != null) {
lineText = lnr.readLine();
if (lineText != null) {
if (lineText.contains("PERFORMANCE MEASUREMENT")) {
s = lineText.toString();
String delims = "PERFORMANCE MEASUREMENT ::";
String[] tokens = s.split(delims);
System.out.println(tokens[1]);

}
}
}

splitted into

BEFORE OOE RESERVE GROUP MEMBER Info >>>> Fri Apr 03 10:16:47 ICT
2009>
AFTER OOE RESERVE GROUP MEMBER Info >>>> Fri Apr 03 10:16:48 ICT 2009>

how can i further split into
1) BEFORE
2) OOE RESERVE GROUP MEMBER Info and 3) Fri Apr 03 10:16:47 ICT 2009




Thanks in advance

Regards
Raj
 
R

Roedy Green

how can i further split into
1) BEFORE
2) OOE RESERVE GROUP MEMBER Info and 3) Fri Apr 03 10:16:47 ICT 2009

you need some more delimiters separated by | See
http://mindprod.com/jgloss/regex.html#SPLIT

Alternatively look at each piece as a new splitting problem. Use split
or String.indexOf.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Think of the earth as a living organism that is being attacked by billions of bacteria whose numbers double every forty years. Either the host dies, or the virus dies, or both die."
~ Gore Vidal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top