From: Robert Klemme Date: 2009-08-19T00:21:07+09:00 Subject: Re: fromdos dos2unix in ruby 2009/8/18 krzysztof cierpisz : >> >> Well, you would read from the input file, replace the dos/windows line >> endings with unix ones and write to the output file. >> > > I tried with following dos2unix.rb script > > ###### dos2unix.rb ###################### > out = File.open(ARGV[1],"w") > > File.open(ARGV[0]).each {|line| >  out << line.gsub!(/\r$/,'') > } > > out.close > ######################################### > > this: > ruby dos2unix.rb u8nl_utf8_tab.dos.txt d > > works fine on Linux (d with length 408 bytes) but not on Windows, on > Windows d is a file with 0 bytes You are not closing the File object properly so your output might never get flushed to disk... Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/