Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Grep Speeds

by spaz (Pilgrim)
on Feb 06, 2001 at 22:38 UTC ( [id://56743]=note: print w/replies, xml ) Need Help??


in reply to Grep Speeds

My suggestion is to internalize your grep command as such (I hope I'm using seek() properly here)
open( FILE, "/PHL/data1/PHL/tmp/ECL_STAT.txt" ) or die "Couldn't open ECL_STAT.txt: $!"; my $found = 0; foreach $item(@timearray){ seek( FILE, 0, 0 ); $searchstring = "$NETID\|$month\/$date\/$year\|$item\|"; while( <FILE> ) { if( /^$searchstring/ ) { push @ECL, $_; $found = 1; last; } } push @ECL, "||$item||" unless $found; } close( FILE ) or die "Couldn't close ECL_STAT.txt: $!";
This is probably a bad suggestion, but it's what I think is right. -- Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-20 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found