Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: text manipulation

by twerq (Deacon)
on Apr 09, 2001 at 06:56 UTC ( [id://70913]=note: print w/replies, xml ) Need Help??


in reply to text manipulation

Do you know exactly how many lines you want removed from the top and bottom of the file? If so, it can be as easy as
# read all the lines in the file into an array @all_lines = (<INFILE>); # grab only the lines you want @stripped_lines = splice(@all_lines, 3, scalar(@all_lines)-5); # output to the new file print OUTFILE @stripped_lines;
Otherwise, if you need to evaluate the data before knowing which lines to remove, you're looking at a regular expression.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-07-18 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.