in reply to Re^2: Matching lines in 2+ GB logfiles.
in thread Matching lines in 2+ GB logfiles.

Perl is more flexible and powerful than grep but definitive not faster. Also AFIK grep (or was it egrep?) uses a finite state machine, not a infinite one like perl, so it is much faster, but much less flexible, i.e. doesn't support back-tracking, etc..

Try to optimise your regex to speed things up. In perl you can use use re 'debug'; to show how many permutations you regex causes.

Replies are listed 'Best First'.
Re^4: Matching lines in 2+ GB logfiles.
by samtregar (Abbot) on May 01, 2008 at 18:24 UTC
    Perl's regular expression engine may be powerful but it doesn't yet use an "infinite" state machine! I think the terms you're looking for are NFA (Nondeterministic Finite Automaton, like Perl) and DFA (Deterministic Finite Automaton, like egrep, sometimes, it's actually a hybrid).

    -sam

      Yes, you are right, that was exactly what I meant. I confused some terms here. Thanks for pointing this out.