From: Brian Candler Date: 2009-02-27T04:43:42+09:00 Subject: Re: Ruby scripting Brad Winborg wrote: > Ruby scripting - I am just starting to learn Ruby and I wanted to know > if anyone out there knows it well. I am trying to do a project and I > have run into a problem. > > I have an executable file that when run creates (n) number of error > logs. So from a command prompt you run the ,exe with with (n) being the > number of logs you wish to create. We will make n =10. Then using ruby > create a program that will search through those 10 error logs and find > and display how many times the word error is found and how many times > the word warning is found. Then Produce a report showing the number of > error and warning log messages for 10-minute over the entire length of > time represented by the generated log files. Start by reading a good Ruby primer - http://www.ruby-doc.org/docs/ProgrammingRuby/ is browsable online for free, or there are many to choose from any buy. Type in and run the examples. Then start writing your own code, and when you get stuck at a particular point, you will be able to ask a more specific question. For example: if you get stuck at iterating over all the files in a directory, look at Dir.glob, which is also callable as Dir[] Dir["foo.*"].each do |fn| puts fn end Also, browse the archives of this list. An almost identical question to yours (about counting flight arrivals and departures) was asked a day or two ago. Good luck, Brian. -- Posted via http://www.ruby-forum.com/.