Randy Kramer wrote:
>
> Even More Irrelevant Aside: The thing that makes the job a little 
> complicated
> is that I can't simply convert line by line, in some cases I have to 
> review
> groups of 5 or more lines and, depending on what is there, convert those 
> to a
> smaller number of lines.  

Have you seen each_slice() before?

require 'enumerator'

#create a file with some data:
File.open("data.txt", "w") do |file|
  (1..22).each do |i|
    file.puts("line #{i}")
  end
end

#read the file in groups of 5 lines:
File.open("data.txt") do |file|
  file.each_slice(5) do |lines|
    p lines
  end
end


--output:--
["line 1\n", "line 2\n", "line 3\n", "line 4\n", "line 5\n"]
["line 6\n", "line 7\n", "line 8\n", "line 9\n", "line 10\n"]
["line 11\n", "line 12\n", "line 13\n", "line 14\n", "line 15\n"]
["line 16\n", "line 17\n", "line 18\n", "line 19\n", "line 20\n"]
["line 21\n", "line 22\n"]

-- 
Posted via http://www.ruby-forum.com/.