"Srinivasa T.N." <se*****@cdotb.ernet.in> wrote in message
news:b5**************************@posting.google.c om...
Hi,
I want to delete the first 3 lines and last 3 lines of a file. How
can I do it? I want to repeat on multiple files..
TIA
Regards,
Seenu.
I'm obviously not as experienced as the other people that have responded,
and didn't quite understand their methods so thought maybe you may not
(though you may - I dunno where everyone's at, I'm new to the newsgroup), so
I thought I'd share my method.
#begin code
open (FIL, "yourfile");
@array=<FIL>; #read the file into an array
close (FIL);
$end=@array; #total in array
$end=$end-3; #to delete the last lines
$i=3; #and the first
open (FIL, ">yourfile"); #reopen file for writing
while($i<$end){
print FIL "$array[$i]\n";
}
close (FIL);
#end code
I haven't tested it, and it may very well have errors in syntax (or other
functionality related items) but that should do what you want and not
require any extra libraries