From: Marc Heiler Date: 2008-06-26T03:17:35+09:00 Subject: Re: Deleting a line in a file This should get you started. There are probably 1000 ways but well, someone else can do that :) The test_file had this content: a b c d The new_file has a b d class DeleteLine def initialize(read_this_file = 'test_file') @file = File.readlines(read_this_file) delete_line 3 save_to end def delete_line(which_line = 1) @file.delete_at(which_line-1) # we may count first line as 1, second line as 2 etc.. otherwise remove the -1 part end def save_to(this_file = 'new_file') File.open(this_file, 'w+') {|f| f.write @file.join() } end end DeleteLine.new -- Posted via http://www.ruby-forum.com/.