Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: search a large text file

by davido (Cardinal)
on Feb 08, 2011 at 11:45 UTC ( [id://886932]=note: print w/replies, xml ) Need Help??


in reply to search a large text file

No need to sort, given your description of the problem.

my @found; while( <file> ) { next unless m/text2/; # Reject disqualified lines quickly. m/\s+(\d+)/ or die "Unexpected data format at file line $.\n"; push @found, $1; }

Dave

Replies are listed 'Best First'.
Re^2: search a large text file
by perl_lover_always (Acolyte) on Feb 08, 2011 at 13:03 UTC
    since my file is big and my searches are often and numerous, searching with this method over a large file is very slow.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found