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

Re: Searching Files

by PhiRatE (Monk)
on Jul 24, 2002 at 22:31 UTC ( #185054=note: print w/replies, xml ) Need Help??

in reply to Searching Files

Other people have already posted reasonable solutions so I'll concentrate on the meta-problem here.

You keep posting questions like this, "I have file of format x with data y and I need to sort/count/total/modify it in way z". I think what you really need to do is likely to involve getting a book on SQL and installing a database. All these problems could have been solved in much more effective ways using simple SQL statements.

In this particular instance, what the poor monks responding to your question took 10+ lines to do could be done in one:

select,count(*) from datastore as n1, datastore as n2 where n2 and n2.yearmonth=200207 and n1.yearmonth<200207 group b +y;

Databases really come into their own with tabular data like this and if you're working with it a lot I *highly* recommend getting the necessary books, reading the online tutorials and installing one of the freely available RDBMSs (MySQL, PostGreSQL). That way the only thing you'll have to get perl to do is load the data in, from there you can play to your hearts content.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2023-06-09 08:18 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (35 votes). Check out past polls.