From: Ferdous ara Date: 2012-09-06T04:17:34+09:00 Subject: Re: get a string from lines of output > If you know that the disk name will always follow (ie. appear below) the > status, try using a flip flop: > > File.foreach("status.txt") do |line| > if line[/Status: Failed/] .. line[/Status: OK/] > puts line if line[/Disk Name:/] > end > end Thats great thanks -- Posted via http://www.ruby-forum.com/.