> -----Original Message-----
> From: Kirk Wythers [mailto:kwyth...@umn.edu] 
> Sent: Wednesday, May 27, 2009 09:31
> To: beginners@perl.org
> Subject: skipping a repeated header
> 
> I have a large datafile that I am trying to read into a postgresql  
> database. I think I have the db_connect stuff down, but I'm fighting  
> with the part that reads the file to be processed. The file 
> contains a  
> repeating structure of header lines like this:
> 
> TOA5  B4WARM_C        CR1000  16474   CR1000.Std.15
> TIMESTAMP     RECORD  Flag(1) Flag(2) Flag(3)
> TS    RN                      
> Smp   Smp     Smp
> 4/29/09 15:10 0       0       0       0
> 4/29/09 15:11 1       0       0       0
> 4/29/09 15:12 2       0       0       0
> 4/29/09 15:13 3       0       0       0
> 4/29/09 15:14 4       0       0       0
> 4/29/09 15:15 5       0       0       0
> 4/29/09 15:16 6       0       0       0
> 4/29/09 15:17 7       0       0       0
> 4/29/09 15:18 8       -1      -1      -1
> 4/29/09 15:19 9       -1      -1      -1
> 4/29/09 15:20 10      -1      -1      -1
> TOA5  B4WARM_C        CR1000  16474   CR1000.Std.15
> TIMESTAMP     RECORD  Flag(1) Flag(2) Flag(3)
> TS    RN                      
> Smp   Smp     Smp
> 4/29/09 15:10 0       0       0       0
> 4/29/09 15:11 1       0       0       0
> 4/29/09 15:12 2       0       0       0
> 4/29/09 15:13 3       0       0       0
> 4/29/09 15:14 4       0       0       0
> 4/29/09 15:15 5       0       0       0
> 4/29/09 15:16 6       0       0       0
> 4/29/09 15:17 7       0       0       0
> 4/29/09 15:18 8       -1      -1      -1
> 4/29/09 15:19 9       -1      -1      -1
> 4/29/09 15:20 10      -1      -1      -1
> 
> 
> I want to read in the lines that begin with the date format, 
> but skip  
> all the header stuff. Can anyone suggest a strategy for a, "if the  

        next if ( ! /^\d/ );
        If you only care about the date, then unless your lines have a
number in the front, then the above will bypass those headers. 

        If the head can have a number then something like:

        next if ( ! m!^\d+/\! );

        Also the group is more willing if you can show code you have
attempted. This is a very simplestic regex test which you should have
gotten from any doc on Perl regex processing. Just a fyi for the future.

         If you have any questions and/or problems, please let me know.
         Thanks.
 
Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight
1.719.484.2097 TEL
1.719.484.2419 FAX
1.408.623.5963 Cell
http://fedex.com/us 


> line begins with XXXX, go ahead and read".
> 
> Thanks in advance.
> 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to