Ah, now that depends on what you call a 'new file'! I imagine Konrad just wanted to avoid the tedium of creating the new corrected file, deleting the old one and then renaming it.
I guess it could be sooooo big that it fills up more than half of the disk drive. I'm sure we'll find out. Cheers, Rob "Timothy Johnson" <[EMAIL PROTECTED]> wrote in message C0FD5BECE2F0C84EAA97D7300A500D50046DD3A7@SMILEY">news:C0FD5BECE2F0C84EAA97D7300A500D50046DD3A7@SMILEY... > > Except that it will essentially create a new file. Why did you want to > avoid writing a new file? As far as I know, you can't just "erase" data in > the middle of a file. That's just not how they work. Someone correct me if > I'm wrong. As far as I know, any program that does this rewrites the file. > The only thing that is somewhat similar is that you can do a sysread and > change part of a file, but I don't think you can remove part of a file > without rewriting it. > > -----Original Message----- > From: Rob Dixon [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 08, 2003 9:20 AM > To: [EMAIL PROTECTED] > Subject: Re: removing emty lines without creating a new file or array > > > Hi Konrad > > Try: > > perl -p -i -e "redo if /^\s*$/" file.ext > > which will remove all lines consisting only of whitespace. > > Cheers, > > Rob > > "Konrad Foerstner" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi, > > > > My problem today ;) : I have a file with some unmeant empty lines and I > > want to remove them, without writing a new file and without storing all > > the content temporarily in an array. I thought about the following lines > > of code, but they don't do the job. > > > > > > open (FH, "+<$filename"); > > > > foreach (<FH>){ > > $_ =~ s/^\n//g; > > } > > > > > > What's wrong? > > > > Konrad > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]