Ruby append to file
examples/files/append_to_file.rb
if ARGV.length != 1 puts "Usage: #{$0} FILENAME" exit end filename = ARGV[0] File.write(filename, 'My second line\n', mode: 'a')
examples/files/append.rb
File.open("data.txt", "a") do|fh| fh.puts "Hello" end