From: cristian cristian Date: 2012-04-19T06:15:08+09:00 Subject: Re: Converting CSV Jan E. wrote in post #1057256: > cristian cristian wrote in post #1057250: >> Ok, thanks! Will this save the new file with the name "new_csv"? > > No, it will overwrite the original file. If you want to write the CSV to > a new file, change the code to > > File.open 'new.csv', 'w' do |csv| > new_csv = File.read('old.csv').gsub(/[^\n\r;]+/, '"\0"').gsub(';', > ',') > csv.print new_csv > end Thanks! Works fine. I have to read a lot about regular expressions to understand it. I will play around a little now with an array of files in the directory. Br cristian -- Posted via http://www.ruby-forum.com/.