Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Reading certain lines in a file

by AidanLee (Chaplain)
on May 24, 2001 at 18:15 UTC ( [id://82910]=note: print w/replies, xml ) Need Help??


in reply to Reading certain lines in a file

I'm uncertain what your sentence here means:

The files is always in this formate where the line i want is right after the line couldn't parse

but as to a general method to use, consider this:

use strict; open(FILE,"myfile") or die "couldn't open input file"; open(OUTFILE,">myotherfile") or die "couldn't open output file"; my @file_lines = <FILE>; for( @file_lines ) { print OUTFILE $_ if /matches_this_pattern/; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://82910]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found