> > > 
> > > perl -i.bak -ne 'print if $.>5; close ARGV if eof' *.txt
> > 

Bob
I have been trying to figure out a different solution then using the -i arg.
Is there a simple way to just open each file, delete the 5 lines in place
and close it(with no backup file), without getting into sysread, truncate,
etc...

something like this:

@files = glob("*.ps");
foreach $file (@files) {
        open (IN, "$file") or die "can't open $!\n";
        while ($line = <IN>) {
                $line =~ s/.*\n// if $. <= 5; 
}
close IN;

-----
I can't seem to delete the lines in place, without using -i, I was able to
do it easily with a shells script using sed:

cd dir_with_the_files
for file in `ls .`
do
        sed '1,5d' $file > $file
done



 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to