Hello,

I am reading a csv file (File1) and putting its content into a string,
then I append that string in another csv file (file2) that has some data
in it already. Now I do not want to overwrite the data in file2 so i've
opened file2 in append mode, and the string from file1 is appended to
file2, but, I lose some characters in the first line of my string, it
looks almost like the first line of my string from file1 is trying to
overwrite the last line in file2 but it doesn't. My string just loses
the same amount of characters of the number of characters from my last
line that was already in file2. Long story short, It won't append
correctly.

Here is the code:

File.new(rightfile,"w")

  fileNew = File.open(rightfile,"w")
    fileNew.puts
'"email","source","ip","data_timestamp_proper","firstname","lastname"'

  str = IO.read(outfile)

  fileAppend = File.open(rightfile,"a")
     fileAppend.puts str

-- 
Posted via http://www.ruby-forum.com/.