Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i need to copy the first 8 lines of ORIGINAL to a new file 1.out.test. then print the next 2 lines to 2.out.testcut_out 8 2
ORIGINAL 1 2 3 4 TO 10
works for the first copy but not the second? thanksopen (true, "<ORIGINAL"); open (edit, "<cut_out2"); open (rest, ">REST"); while (<edit>) { chomp; $j = $_; print $j; open (out, ">$.out.test"); while (<true>){ if (1..$.==$j) {print out} else {print rest}; print "\nCUT"; rename (REST, COMPARE); } } ~
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: removing lines from a file
by Random_Walk (Prior) on Feb 18, 2005 at 10:40 UTC | |
by Anonymous Monk on Feb 18, 2005 at 10:44 UTC | |
|
Re: removing lines from a file
by gopalr (Priest) on Feb 18, 2005 at 10:31 UTC | |
by CountZero (Bishop) on Feb 18, 2005 at 11:27 UTC | |
by Anonymous Monk on Feb 18, 2005 at 10:35 UTC | |
by gopalr (Priest) on Feb 18, 2005 at 10:41 UTC | |
by Anonymous Monk on Feb 18, 2005 at 10:39 UTC | |
|
Re: removing lines from a file
by Anonymous Monk on Feb 18, 2005 at 10:40 UTC | |
|
Re: removing lines from a file
by Miguel (Friar) on Feb 18, 2005 at 17:35 UTC |