Revision: 80622
Updated URL
Updated Code
Updated Description
at March 23, 2020 05:49 by chrisaiv
Updated URL
https://www.chrisjmendez.com/2008/06/04/ruby-open-a-text-file-and-re-write-its-contents-into-a-new-text-file/
Updated Code
https://www.chrisjmendez.com/2008/06/04/ruby-open-a-text-file-and-re-write-its-contents-into-a-new-text-file/
Updated Description
https://www.chrisjmendez.com/2008/06/04/ruby-open-a-text-file-and-re-write-its-contents-into-a-new-text-file/
Revision: 6655
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 4, 2008 20:03 by chrisaiv
Initial Code
counter = 1 old_file = File.open("./Car.txt", "r") new_file = File.new("./NewCar.txt", "w") while( line = old_file.gets ) new_file.puts "#{counter}: #{line}" counter = counter + 1 end new_file.close
Initial URL
Initial Description
Basic example of how to open a text file and print them (including line-numbers) into a new text file
Initial Title
Open a text file and re-write its contents into a new text file
Initial Tags
ruby
Initial Language
Ruby