Using ruby to fix line endings
I just f*@&ed up my svn entries file by changing the line endings during a manual edit (note: don’t try that at home). But anyways the fix was to load the file in binary mode, strip the spurious line endings and re-write the file in binary mode
e = []; File.open('entries', 'rb') {|f| e = f.read }
File.open('entries', 'wb') {|f| f.write(e.gsub(/\x0D\x0A/, "\x0A") }
Advertisement
Categories: ruby
line-endings, ruby, svn