public
Created

File Write Example

  • Download Gist
file_write.rb
Ruby
1 2 3 4 5 6 7
pdf_file = File.open("in.txt") # here in.txt is the input file that you want to read
output_file = File.open("out.txt", "w")
pdf_file.readlines.each do |l|
output_file.puts(l)
end
output_file.close
pdf_file.close
in.txt
1 2 3 4 5
Some text in file
Another line of text
 
1. Line 1
2. Not really line 2

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.