Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: removing lines from a file

by Miguel (Friar)
on Feb 18, 2005 at 17:35 UTC ( [id://432433]=note: print w/replies, xml ) Need Help??


in reply to removing lines from a file

Another alternative:

Updated: to include the cut_out.txt file.

#!/usr/bin/perl -w use strict; use IO::All; my @cut_out = io("cut_out.txt")->slurp; my @lines = io('original.txt')->slurp; my $total_lines = 0; $total_lines += $_ foreach @cut_out; for (my $i = 0; $i <= ($total_lines - 1); $i++ ) { $i <= $cut_out[0] - 1 ? io("1.out.test.txt")->append($lines[$i]) : io("2.out.test.txt")->append($lines[$i]) }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-24 03:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found