Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Searching Files

by PhiRatE (Monk)
on Jul 24, 2002 at 22:31 UTC ( [id://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 n2.name,count(*) from datastore as n1, datastore as n2 where n2 +.name=n1.name and n2.yearmonth=200207 and n1.yearmonth<200207 group b +y n2.name;

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-19 07:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found