Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: File Search And Compare

by zengargoyle (Deacon)
on Feb 19, 2002 at 06:51 UTC ( [id://146340]=note: print w/replies, xml ) Need Help??


in reply to File Search And Compare

If you're lucky your timestamps are fixed width and you can use substr.
my $ts_fmt = 'MMM DD HH:MM:SS '; my $line = 'Feb 18 00:12:14 foo bar bat baz fwa'; my $time = substr($line, 0, length $ts_fmt, ''); chop $time; # pesky space.. # $time is the time part. # $line holds the part after the time is removed.
If you're searching for fixed string, index might be faster than regex.
my $match = 'fwa'; if ( -1 != index($line,$match)) { # matched! $seen_lines{$line}++; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-16 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found