Advertisement

04.26.2008 at 07:33PM PDT, ID: 23356541
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Need to Parse Large, Complex Text File

Asked by AnthonyP9618 in PHP and Databases, Scripting Languages, Regular Expressions

Tags: , , , ,

OK, here goes.

I need help parsing a somewhat large text file to pull out several 8 digit codes.  These codes actually correlate to lat/long pairs that will be stored into a database and eventually plotted on a map.  

Here's where I need the help -- I have no idea where to even begin to pull the correct information out.  What I do have is an idea of the layout of the data that should be pulled out of the text file.  I've posted the contents of the text file to this question with the hopes that someone can give me a hand in getting everything parsed.

Here's the information I would like to be pulled:

array = [Probablistic, Tornado, 0.02, 29690211, 30720267, 31770266, 33050266, 33860224, 34130117, ... ]
array = [Probablistic, Hail, 0.05, 45287527, 41977617, 39227668, 37907685, 35827827, 34187959, ... ]
array = [Probablistic, Hail, 0.05, 29090400, 33280358, 34410277, 35770123, 37580020, 38930032, ... ]
... etc...
... etc...

array = [Categorical, SLGT, 29680224, 30890281, 32990280, 34040203, 34470120, 34380036, ... ]
array = [Categorical, TSTM, 30918077, 30308242, 30248345, 29798491, 29218483, 99999999, ... ]

In any case, I hope my question is clear enough for someone to give me a hand.  Any idea will work for me as well.  I'm developing in PHP, but I also have access to do a cron job if it's something that might require perl or C.  Whether the solution is through regex, fancy split() functions or something else, I'm not picky.

Thanks.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
DAY 1 CONVECTIVE OUTLOOK AREAL OUTLINE
NWS STORM PREDICTION CENTER NORMAN OK
0258 PM CDT SAT APR 26 2008
 
VALID TIME 262000Z - 271200Z
 
PROBABILISTIC OUTLOOK POINTS DAY 1
 
... TORNADO ...
 
0.02   29690211 30720267 31770266 33050266 33860224 34130117
       33749948 33209845 32289772 30579792 29779940 29500144
&&
 
... HAIL ...
 
0.05   45287527 41977617 39227668 37907685 35827827 34187959
       33138149 32388311 31818554 31108676 29628733 
0.05   29090400 33280358 34410277 35770123 37580020 38930032
       39569862 39519691 38599627 37629653 36809774 36139833
       35259857 34759723 33479575 32979376 33379196 33718961
       34138660 35458355 37028149 39977996 44047836 
0.15   29690220 31000284 33000275 34010208 34470120 34390036
       33699887 32839706 30899635 29339702 28439897 28480065
0.30   33450087 33359965 33129897 32569845 31869842 31209861
       30879896 30919984 31070072 31220140 31610177 32270182
       32980164 33320125 33450087 
&&
 
... WIND ...
 
0.05   29070394 31640342 33610293 35820097 37370016 38920020
       39739909 39529685 37799683 37059779 35829870 35259864
       34659701 32869475 32529332 33638980 34108650 34718508
       35428319 37048143 37498093 39427993 44067832 99999999
       45157471 39547505 34917801 32398301 31798558 31028674
       29858732 
0.15   29670224 31080286 33020261 33890201 34100088 34009975
       33459833 32789708 30899635 29329708 28399897 28490054
0.30   32980150 33340108 33430044 33159917 32709844 32099808
       31359814 30949840 30689883 30519960 30470007 30520044
       30850100 31220134 31700157 32410162 32980150 
&&
 
CATEGORICAL OUTLOOK POINTS DAY 1
 
... CATEGORICAL ...
 
SLGT   29680224 30890281 32990280 34040203 34470120 34380036
       33899929 32839713 30899635 29349702 28469886 28480045
TSTM   30918077 30308242 30248345 29798491 29218483 99999999
       35887503 35397618 34857699 34387750 33367816 99999999
       45097312 42817372 41657414 41027415 40387396 40017352
       99999999 30150486 31020486 31810480 32850436 33750355
       34610292 35950141 36860069 37960030 38890119 39530257
       40880377 41660472 42650463 43390427 43510337 43340247
       43060125 42609989 41739869 41239738 40079561 39429407
       38509382 37759505 36879651 36319740 35909807 35399828
       35089782 34989696 35049592 35059483 35059399 35179332
       35209200 35848839 35588648 36128428 36638291 37328189
       38358172 39048176 40258139 42608062 
 
&&
THERE IS A SLGT RISK OF SVR TSTMS TO THE RIGHT OF A LINE FROM 25 S
6R6 FST 30 NE HOB 20 WSW PVW 35 NE PVW CDS 45 W SPS 15 E FTW 20 N
CLL 35 N VCT 20 E COT 70 SSE DRT.
 
GEN TSTMS ARE FCST TO THE RIGHT OF A LINE FROM 45 ESE SSI 45 NNW GNV
40 SSW VLD 10 ENE AAF 40 SSE AAF ...CONT... 55 NE HSE 35 WNW HSE 15
SSE EWN 25 ENE ILM 50 ESE CRE ...CONT... 45 N BTV ALB 15 W POU 20 N
EWR 20 SSW JFK 45 E NEL ...CONT... 50 WSW MRF 55 S GDP GDP 30 SSE
ROW 45 SSW CVS 30 NE CVS 20 N BGD 20 SE LBL 20 NW DDC 40 SE GLD 25
NW ITR 45 WSW SNY 35 N CYS 40 E DGW 70 NW CDR 40 SSW RAP 45 NE CDR
40 WNW VTN ANW 25 E BUB 15 S OLU FNB 35 NE MKC 20 SW SZL 25 ENE CNU
30 WNW BVO 30 E END 30 SSW END 25 NW CHK 10 ESE CHK 45 SE OKC 15 NW
MLC 10 W RKR 30 SE FSM 15 WSW RUE 35 NNE LIT 35 ENE MKL 40 SSE BNA
25 NW TYS 30 WNW TRI 40 W BLF CRW 30 SW PKB 35 NE ZZV 40 NNW ERI.
[+][-]04.26.2008 at 08:01PM PDT, ID: 21447968

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.26.2008 at 08:23PM PDT, ID: 21448010

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.26.2008 at 08:58PM PDT, ID: 21448064

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.26.2008 at 09:53PM PDT, ID: 21448198

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, Scripting Languages, Regular Expressions
Tags: php, regex, parse, apache, text
Sign Up Now!
Solution Provided By: JesterToo
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906