Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: grabbing certain lines

by adrianh (Chancellor)
on Nov 12, 2002 at 09:45 UTC ( #212233=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: grabbing certain lines
in thread grabbing certain lines

I belive you'll find that still reads the entire file in before running the grep - so filtering the file first doesn't really give you anything.

If the size of the file is an issue you'll want to use a loop to go over it line by line. Something like this should do it:

my %name2email; while (<DATA>) { next unless m/^(?:To|From|Reply-To): (\S+)\s+<?([^\s>]+)/; $name2email{$1} = $2; };

Note: the regex doesn't cope with a fair bit (multiple addresses, addresses without names, etc.).


Comment on Re^3: grabbing certain lines
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (14)
As of 2014-08-01 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (27 votes), past polls