From: Richard Schneeman Date: 2008-08-26T07:16:01+09:00 Subject: Re: Open file, get first line, delete first line close file I've set it up with a rake task and a cron job, that re-runs every 5hrs (my timeout window) i this is the code that i've already uploaded, and is currently running... namespace :chinese do desc "adds all chinese files to database" task :create => :environment do active_dictionary = File.readlines("public/languages/chinese/practice.txt") count = 0 for @element in active_dictionary count += 1 process_chinese open('public/languages/chinese/practice.txt', 'w') do |file| file.puts active_dictionary[count,active_dictionary.size] end end end end where process_chinese contains all my proprietary code, i played around with only writing to the file every time i've processed ten entries, but it only cut my process time down by a trivial amount of time, so i just let it write over the file after every line. As we've seen here, there are quite a few ways this can be accomplished, this ended up working...and didn't kill my processor (the writes to the DB are infinitely more expensive than opening and writing to this file). Thanks for the help!! Richard -- Posted via http://www.ruby-forum.com/.