Supose I want to parse a big log file (~500MB/4mil lines), which one is
faster and use less memory:


$ ./parser.pl logfile.log

or

$ grep 'Jun 14 03:' | ./parser.pl

Log file is 24 hours and it will be processed every hour.

------
parser.pl:
$in_time = 'Jun 14 03:';

while(<>)
{
    if(/^$in_time/ {
       # do some processing
    }else {
       next;
    }
}


-- 

--beast


--
Unsubscribe mailto:[EMAIL PROTECTED]
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

Reply via email to