Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: File Search And Compare

by PyroX (Pilgrim)
on Feb 18, 2002 at 22:18 UTC ( [id://146269]=note: print w/replies, xml ) Need Help??


in reply to File Search And Compare

OK!

But now I have a new problem, I think that may work, but there is a timestamp in each line, so I need so split before you process the line in the file. The split needs to be a regular expression split, of ':01-60 ' so that is will be split with ':' and any number 01 - 60 followed by a space, together:

':34 ' or ':21 ' or ':57 ' would all work, this is the seconds in the timestamp of course. that should leave us with an array with [0] (the trash) and 1 (the goodies)

I tried inserting somehting like:
# create variables: # $pattern - pattern for regular expression # %parsed - hash, keys are lines containing pattern, # values are counter of times seen # $i - counter of total lines matching pattern my $pattern = 'fwa'; my (%parsed, $i); while(<$FILE>){ # read line from filehandle, assign to special variable $_ if(/$pattern/i && $i++) { chomp $_; # remove newline @new=split(/:[01-60] /,$_); $_=$new[1]; $parsed{ $_ }++; # use line as hash ect ect ect.......


But that didn't work, and I am unsure of both the regex, and ties with your code. Any more help would be much appriciated.

Replies are listed 'Best First'.
Re: Re: File Search And Compare
by particle (Vicar) on Feb 18, 2002 at 22:36 UTC
    you don't want to use split like that, it won't do what you want. can you include at least one line of input data? it's rather hard to debug this sort of error without it. you should probably use a regular expression, but i can't say without sample data.

    ~Particle

Log In?
Username:
Password:

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

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

    No recent polls found