From: Robert Klemme Date: 2006-10-18T18:45:06+09:00 Subject: Re: merging files with CR as EOL ? On 18.10.2006 11:37, Une B�vue wrote: > i have to rewrite a script in order to be compatible with file lines > ending by CR instead of unix \n > > my script is simple, it take the content of a folder and merge the file > all together in a unique file, those files have CR lines ending and such > must be the merged file. > > what to do in that case ? You could do something like # untested File.open("result.txt", "wb") do |out| Dir["*"].each do |file| File.open(file) do |in| in.each_line do |line| line.chomp! out.write(line) out.write("\r\n") end end end end Kind regards robert