Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Multiple patterns match in a big file and track the counts of each pattern matched

by ansh007 (Novice)
on Dec 04, 2017 at 11:07 UTC ( [id://1204836]=note: print w/replies, xml ) Need Help??


in reply to Re: Multiple patterns match in a big file and track the counts of each pattern matched
in thread Multiple patterns match in a big file and track the counts of each pattern matched

I tried this. It works, but it takes more than 3 and a half minutes. I guess because of grep, but i am not sure. Thanks for your time.

  • Comment on Re^2: Multiple patterns match in a big file and track the counts of each pattern matched

Replies are listed 'Best First'.
Re^3: Multiple patterns match in a big file and track the counts of each pattern matched
by choroba (Cardinal) on Dec 04, 2017 at 11:41 UTC
    Yes, that's probably the reason.

    What about embedded code?

    my %matched; my $i; my $regex = join '|', map +($i++, "$_(?{\$matched{$i}++})")[1], map qu +otemeta, @pat_array; open my $LOG,'<', $InLogFilePath or die "can not open file :$!"; while (<$LOG>) { use re 'eval'; chomp; /$regex/ if $. > $InStartLineNumber; } close $LOG; for my $pattern (keys %matched) { print "$pattern\t$matched{$pattern}\n"; }

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1204836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found