S
Snail
I've been trying to find a way to remove a line containing a specific
string.
In my case, I have a dir full of logs files and I want to remove all
lines containing "127.0.0.1" or "localhost", because those lines take up
more than 95% of the text in the logs making them rather big. Removing
those lines will make our logs much easier to read.
I found the opendir and readdir functions, but what if I want to
recurse. I suppose I could just while(<LOGFIE>) loop over each line and
check, but I'm not sure how to erase the line.
Or is there a better way to do this?
Thank you for any advise and help.
(PS: Running on a Linux platform, with Perl 5.6.1)
string.
In my case, I have a dir full of logs files and I want to remove all
lines containing "127.0.0.1" or "localhost", because those lines take up
more than 95% of the text in the logs making them rather big. Removing
those lines will make our logs much easier to read.
I found the opendir and readdir functions, but what if I want to
recurse. I suppose I could just while(<LOGFIE>) loop over each line and
check, but I'm not sure how to erase the line.
Or is there a better way to do this?
Thank you for any advise and help.
(PS: Running on a Linux platform, with Perl 5.6.1)