From: Bertram Scharpf Date: 2009-08-31T19:05:53+09:00 Subject: Re: text lines manipulation Hi, Am Montag, 31. Aug 2009, 18:46:53 +0900 schrieb George George: > have a set of lines like shown below: > #set1 > 1-3 > 3-5 > 6-7 > #set2 > 20-23 > 450-550 > #set3 > 1-50 > 20-56 > > The idea is to read each of the lines associated with each set and do > some manipulation? Untested: file.each_line { |l| l.chomp! case l when /^#/ then set = $' else do_sth_with set, l end } Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de