![]() |
|
go ahead... be a heretic | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
Unless I'm missing something, you've moved the filehandle position to the beginning with seek. When you subsequently truncate to size tell(LOG) it truncates it to zero size, because 0 is where you've seeked to. Try setting the position to a variable first:
That corrects the immediate problem, but will still leave the line in question in place. If you set a variable to the string length of the line you've matched, and
that should get rid of your matched line. Note: there may be better ways to do this. Update: I also strongly agree with the first line of frodo72s response, especially as you've said that the file is growing quickly. I would be inclined to use two files, and write everything that doesn't match your regex out to the second file
-------------------------------------------------------------- g0n, backpropagated monk In reply to Re: removing lines from a file
by g0n
|
|