Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: removing lines from a file

by Miguel (Friar)
on Feb 18, 2005 at 17:35 UTC ( #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]) }


Comment on Re: removing lines from a file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-07-30 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls