I\'d like to add a single line to the top a of file with Ruby like this:
# initial file contents something else # file contents after prepending \"hello\" o
You can try this:
File.copy_stream(myfile,tempfile) f = File.open(myfile,'w') f.write("Hello\n#{File.open(tempfile,'r').read}") f.close File.delete(tempfile)