Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

licking9Volts's scratchpad

by licking9Volts (Pilgrim)
on Jun 02, 2004 at 21:27 UTC ( [id://359762]=scratchpad: print w/replies, xml ) Need Help??

All of the files I'm reading have this at the at the top of the file:
~Version Information VERS . 2.00 : CWLS Log ASCII Standard - V +ersion 2.00 WRAP . NO : One line per depth step # ~Well Information #MNEM.UNIT DATA : DESCRIPTION #----.---- --------- : ----------------- STRT .FT 13400.000 : Start STOP .FT 15870.000 : Stop STEP .FT 0.500 : Step increment NULL . -999.250 : Null value COMP . : Company WELL . : Well FLD . : Field # ~Curve Information #MNEM.UNIT API CODES : CURVE DESCRIPTION #----.---- --------- : ----------------- DEPT .FT 00 001 00 00 : Logged depth GR .GAPI 30 310 01 00 : Gamma Ray DRHO .G/C3 42 356 01 00 : Density Correction # ~Parameter Information #MNEM.UNIT VALUE : DESCRIPTION #----.---- --------- : ----------------- DREF . K.B. : Depth reference GL .FEET 1185.00 : Ground elevation RUN . ON : Run number TDD .FEET 15850.000 : TD (driller) TDL .FEET 15870.000 : TD (logger) # ~Other Information
The lines with tildes don't always have a full sentence. Sometimes they only have the tilde and the letter right after it. ~V, or ~P for example. It is mandatory that the line has at least that to mark the sections. Case doesn't matter. After this header is a huge data section that consists of thousands of lines of data that I don't need my program to read through. Actually, I can stop once I see the ~P section so that's what I'd like to find. My code looks like this:
if (/~P/i) { print "\nHit a tilde!\n"; $section = '1'; $section2 = '0'; }
For some reason, it kept reading through the entire file instead of stopping so I thought it wasn't matching the ~P. I got more confused when I was reading about some regexes matching what you don't expect due to the "zero or more" characteristic of some patterns. I thought that was what was happening to me. I added the "Hit a tilde" line to see if it was indeed matching and it looks like it is. The actual problem is something else in here.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-23 07:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found