Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How to optimize a regex on a large file read line by line ?

by John FENDER (Acolyte)
on Apr 16, 2016 at 17:55 UTC ( [id://1160658]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        echo 1:%time%
        unzip -p 10-million-combos.zip | grep 123456$ | wc -l
    ...
        grep 123456$ 10-million-combos.txt  | wc -l
        echo 3:%time%
        pause
    
  2. or download this
    1:19:16:46,11
      61466
    2:19:16:48,43
      61466
    3:19:16:49,00
    
  3. or download this
    zip piped : 3,89
    
    ...
    perl direct : 2,29
    
    perl "demo.pl"
    
  4. or download this
    echo %time%& grep 123456$ C:\Users\admin\Desktop\10-million-combos.txt
    + | wc -l& echo %time%
    echo %time%& type "C:\Users\admin\Desktop\10-million-combos.txt" | per
    +l -ne "BEGIN{$n=0} $n++ if /123456$/; END{print $n}"& echo.&echo %tim
    +e%
    echo %time%& perl demo.pl& echo %time%
    
  5. or download this
    19:43:28,91/61466/19:43:29,51 for grep (0,6)
    19:45:29,51/61466/19:45:34,71 for perl (5,2)
    19:46:13,27/61466/19:46:15,47 for perl (direct) (2,2)
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found