Page 1 of 1

Reading a Complicated Text File

Posted: Fri Aug 21, 2009 2:46 pm
by Aravinthan
Hi guys,

Ok so here is the problem, I got 2 complicated text files, that I need to read...

First file(reportss.txt):
#2500
Toronto Maple Leafs 2 , New York Islanders 3
Shots: 20 - 26
TOR PP: 1 of 4 (3 shots), Passing:61/78=78 %, Challenges:33/38=84 %
NYI PP: 0 of 5 (10 shots), Passing:73/90=81 %, Challenges:40/52=75 %
Attendance: 8821 of 18819 (Air Canada Centre)
Ticket income: 279626 Match televised: No


Toronto Maple Leafs scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Loui Eriksson 0 0 0 0 0 0 0 -2 6.00 6
R Mark Parrish 0 0 1 4 0 6 0 0 14.30 8
R Viktor Kozlov 0 0 1 0 0 0 0 0 9.00 6
R Teemu Selänne 1 1 5 0 0 0 0 0 19.20 8
C Patrik Berglund 0 0 1 0 1 0 0 -2 7.50 6
C Mike Ribeiro 0 1 1 0 0 0 4 0 20.20 7
C Stephen Weiss 0 0 1 1 0 0 0 0 15.50 6
C Stu Barnes 0 0 2 0 0 0 4 0 16.00 7
L Sean Bergenheim 0 0 1 0 0 0 0 -2 6.00 6
L Brooks Laich 0 0 0 0 1 1 0 0 16.30 6
L Niklas Hagman 0 0 2 1 1 1 0 0 16.40 7
L Jason Blake 0 1 1 0 0 0 0 0 20.50 7
D Matt Niskanen 0 0 0 1 1 0 0 0 20.00 6
D Jack Johnson 0 0 0 1 0 0 0 -1 11.10 6
D Kenny Jönsson 1 1 2 1 1 0 0 -1 27.40 8
D Jonas Frögren 0 0 0 2 0 2 0 0 15.20 7
D Willie Mitchell 0 0 2 2 0 0 0 0 19.00 7
D Sheldon Souray 0 0 2 2 0 2 2 -2 26.50 7
(GA, A, Sv , PIM, +/- Icetime Rating)
G Ed Belfour 3 0 23 0 0 58.50 6
G Justin Pogge 0 0 0 0 0 0.00 0

New York Islanders scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Jeremy Williams 0 0 1 0 0 0 0 0 5.20 6
R Kyle Okposo 0 0 1 0 1 0 0 1 15.10 7
R Jamal Mayers 1 1 2 2 1 0 0 1 20.40 9
R Richard Park 0 0 2 2 3 0 2 0 18.50 6
C Frans Nielsen 0 0 0 0 0 0 2 0 5.20 6
C Mark Bell 0 0 2 1 0 0 0 1 15.50 8
C Doug Weight 0 1 2 2 0 0 0 1 19.00 8
C Joe Sakic 0 0 4 0 1 0 0 0 19.50 7
L Jon Sim 0 0 1 3 0 1 2 0 5.20 7
L Andy Hilbert 1 0 1 1 0 2 0 1 8.30 7
L Ladislav Nagy 1 1 3 1 0 0 0 1 18.30 8
L Darcy Tucker 0 0 4 1 0 0 0 0 20.20 8
D Niklas Grossman 0 0 0 0 0 1 0 1 8.30 6
D Mark Streit 0 0 0 0 0 0 0 1 20.00 7
D Andy Sutton 0 0 0 1 2 1 2 0 29.20 7
D Staffan Kronwall 0 0 0 0 1 0 0 1 9.30 5
D Freddy Meyer 0 1 5 1 3 0 0 1 23.50 7
D Jay Bouwmeester 0 0 1 2 0 0 0 0 28.50 7
(GA, A, Sv , PIM, +/- Icetime Rating)
G Marty Turco 2 0 18 0 0 60.00 8
G Curtis Joseph 0 0 0 0 0 0.00 0

Three stars of the game:
1st star: Jamal Mayers
2nd star: Ladislav Nagy
3rd star: Teemu Selänne

Notes for Toronto Maple Leafs:

Notes for New York Islanders:

Other notes:


###
Here is the second file(boxscores.txt):
#2500
12:37 0-1 NYI Jamal Mayers [1] (Ladislav Nagy, Doug Weight)
------------------------------------------------------------
31:49 0-2 NYI Ladislav Nagy [1] (Jamal Mayers, Freddy Meyer)
37:16 1-2 TOR Teemu Selänne [1] (Jason Blake, Kenny Jönsson)
------------------------------------------------------------
41:49 1-3 NYI Andy Hilbert [1])
48:49 2-3 TOR Kenny Jönsson [1] (Teemu Selänne, Mike Ribeiro)PP
------------------------------------------------------------
This is only the 1st data.

There is alot like this, so what I want to do is:

- Insert the 2500(gameID) in a MYSQL coloum named id

- Insert:
QuoteToronto Maple Leafs 2 , New York Islanders 3
in a Mysql coloum name result

- Insert:
Toronto Maple Leafs scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Loui Eriksson 0 0 0 0 0 0 0 -2 6.00 6
R Mark Parrish 0 0 1 4 0 6 0 0 14.30 8
R Viktor Kozlov 0 0 1 0 0 0 0 0 9.00 6
R Teemu Selänne 1 1 5 0 0 0 0 0 19.20 8
C Patrik Berglund 0 0 1 0 1 0 0 -2 7.50 6
C Mike Ribeiro 0 1 1 0 0 0 4 0 20.20 7
C Stephen Weiss 0 0 1 1 0 0 0 0 15.50 6
C Stu Barnes 0 0 2 0 0 0 4 0 16.00 7
L Sean Bergenheim 0 0 1 0 0 0 0 -2 6.00 6
L Brooks Laich 0 0 0 0 1 1 0 0 16.30 6
L Niklas Hagman 0 0 2 1 1 1 0 0 16.40 7
L Jason Blake 0 1 1 0 0 0 0 0 20.50 7
D Matt Niskanen 0 0 0 1 1 0 0 0 20.00 6
D Jack Johnson 0 0 0 1 0 0 0 -1 11.10 6
D Kenny Jönsson 1 1 2 1 1 0 0 -1 27.40 8
D Jonas Frögren 0 0 0 2 0 2 0 0 15.20 7
D Willie Mitchell 0 0 2 2 0 0 0 0 19.00 7
D Sheldon Souray 0 0 2 2 0 2 2 -2 26.50 7
(GA, A, Sv , PIM, +/- Icetime Rating)
G Ed Belfour 3 0 23 0 0 58.50 6
G Justin Pogge 0 0 0 0 0 0.00 0
In home_team scoring

- Insert:
New York Islanders scoring.
( G A Sh Hi Ga Ta PIM, +/- Icetime Rating)
R Jeremy Williams 0 0 1 0 0 0 0 0 5.20 6
R Kyle Okposo 0 0 1 0 1 0 0 1 15.10 7
R Jamal Mayers 1 1 2 2 1 0 0 1 20.40 9
R Richard Park 0 0 2 2 3 0 2 0 18.50 6
C Frans Nielsen 0 0 0 0 0 0 2 0 5.20 6
C Mark Bell 0 0 2 1 0 0 0 1 15.50 8
C Doug Weight 0 1 2 2 0 0 0 1 19.00 8
C Joe Sakic 0 0 4 0 1 0 0 0 19.50 7
L Jon Sim 0 0 1 3 0 1 2 0 5.20 7
L Andy Hilbert 1 0 1 1 0 2 0 1 8.30 7
L Ladislav Nagy 1 1 3 1 0 0 0 1 18.30 8
L Darcy Tucker 0 0 4 1 0 0 0 0 20.20 8
D Niklas Grossman 0 0 0 0 0 1 0 1 8.30 6
D Mark Streit 0 0 0 0 0 0 0 1 20.00 7
D Andy Sutton 0 0 0 1 2 1 2 0 29.20 7
D Staffan Kronwall 0 0 0 0 1 0 0 1 9.30 5
D Freddy Meyer 0 1 5 1 3 0 0 1 23.50 7
D Jay Bouwmeester 0 0 1 2 0 0 0 0 28.50 7
(GA, A, Sv , PIM, +/- Icetime Rating)
G Marty Turco 2 0 18 0 0 60.00 8
G Curtis Joseph 0 0 0 0 0 0.00 0

In away_team_scoring


- Insert this:
12:37 0-1 NYI Jamal Mayers [1] (Ladislav Nagy, Doug Weight)
------------------------------------------------------------
31:49 0-2 NYI Ladislav Nagy [1] (Jamal Mayers, Freddy Meyer)
37:16 1-2 TOR Teemu Selänne [1] (Jason Blake, Kenny Jönsson)
------------------------------------------------------------
41:49 1-3 NYI Andy Hilbert [1])
48:49 2-3 TOR Kenny Jönsson [1] (Teemu Selänne, Mike Ribeiro)PP
------------------------------------------------------------
In boxscore

- Insert this:
Three stars of the game:
1st star: Jamal Mayers
2nd star: Ladislav Nagy
3rd star: Teemu Selänne
In three_stars

- Insert :
Notes for Toronto Maple Leafs:
In Home_team_notes
Notes for New York Islanders:
in away_team_notes
Other notes:
[/quote][/quote]
in other_notes

And sometimes, after like 10-30 games
there is farm team results,
that appears underneath the other notes,

So that goes in:
farm_team_results

I tried to make something for almost 2 weeks now, without getting anything...

So it's time for me to see the experts,

Any help is appreciated,

Thanks Ara

Re: Reading a Complicated Text File

Posted: Fri Aug 21, 2009 5:04 pm
by Aravinthan
Hi thanks for your reply,

I read those but I jsut cant seem to know what to do..


I fixed the quote tags,

boxscores file:
http://www.sendspace.com/file/qwepe0

reports file:
http://www.sendspace.com/file/6p6bpk

Re: Reading a Complicated Text File

Posted: Sat Aug 22, 2009 8:15 am
by Aravinthan
UP