From: "John W. Kennedy" Date: 2005-12-31T20:04:00+09:00 Subject: Re: create file with LF (not CRLF) in windows Ben Anderson wrote: > Hi, > I have a bunch of files that I want to convert from CRLF to just LF. > How might I do this? I'm testing with the following example file > (steel.rb): > > f = File.new("steel", "w") > f.syswrite("steel\ncity"); > f.close > > I then run this from cygwin and get the following output > > Ben Anderson@andersonbd1 /cygdrive/c/ruby > $ ruby steel.rb > > Ben Anderson@andersonbd1 /cygdrive/c/ruby > $ cat -v steel > steel^M > city > > How might I get rid of the CR and just have ruby use an LF? Just as in many other languages, use "wb" instead of "w". -- John W. Kennedy "But now is a new thing which is very old-- that the rich make themselves richer and not poorer, which is the true Gospel, for the poor's sake." -- Charles Williams. "Judgement at Chelmsford"