On 11/29/06, Drew Olson <olsonas / gmail.com> wrote: > My code is working but I don't find it very "rubyish". In particular, I > hate having my index and counter counters and I don't like that I had to > declare my header variable outside of the loop. Bear in mind here that I > can not do something like "rows = CSV.open(infile)" because ruby will > yell and error as the input file is too big (250 mb). Any advice on > making the code nicer is appreciated. The current code is as follows: File.open("test", "w+") do |f| 20.times do |i| f.write "abc|def|ghi#{i}\n" end end File.open("test", "r") do |fin| part = 0 while row = fin.gets File.open("test_part#{part}", "w+") do |f| 5.times do f.write(row) break unless row = fin.gets end end part += 1 end end -- Simon Strandgaard http://opcoders.com/