On 25 Apr 2008, at 10:28, Paul Donaghy wrote:
> Hi Guys,
>
> I have a number of results files inside a /results folder such as
>
> /results/results1.txt
> /results/results2.txt
> ...
> ... and so on.
>
> Inside each of these files are messages either
> This feature Passed
> This feature Failed
>
> What I want to do is read all of these files /results/results* and  
> pick
> out the messages that say FAILED and store them in a variable or
> whatever so I can print them to screen.
>
> Any you guys any bright "easy" ideas?
>
> Help much appreciated.Thanks.
> -- 
> Posted via http://www.ruby-forum.com/.


If really that's all you want to do then I'd just use grep rather than  
Ruby:

grep FAILED results/*.txt

Alex Gutteridge

Department of Biochemistry
University of Cambridge