hi Cee -

  this may well be WAY to simple for your needs, but it seems to me you 
could so something like this:

(0text.txt is a file with 7 lines that say rubyrubyrubyetc.)

  f = "0text.txt"
  file  = File.open(f)
  buffer = []
  bufferindex = 0

  file.each_line{|line|
       buffer[bufferindex] = line.chomp
       bufferindex += 1
  }

p buffer[0]
p buffer[1]
p buffer[2]
#etc...

  of course you could also set a maximum number of lines per buffer:

  f = "0text.txt"
  file  = File.open(f)
  buffer = Hash.new{|key, value| key[value]= []}
  bufferkey = 0
  maxbuflength = 3

  file.each_line{|line|
    if buffer[bufferkey].length == maxbuflength
      bufferkey +=1
      buffer[bufferkey] << line.chomp
    else
      buffer[bufferkey] << line.chomp
    end
  }

p buffer[0]
p buffer[1]
p buffer[2]

  if the file's extremely long i guess you'd want to write a method to 
dump the buffers at some point too.

  maybe this is dumb, i hope not!
  cheers,

  -j

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