From: ser@... (Sean Russell) Date: 2004-06-10T00:33:50+09:00 Subject: Re: strip DOS ^Ms? Dick Davies wrote in message news:<20040609105715.GA24830@lb.tenfour>... > They're not at end of line though, they're just scattered through the > lines... and vi/dos2unix isn't an option , I'm doing this on a string > on its way from the webserver to REXML... Use tr. I generally strip DOS idiocy on the command line with: tr -d '\r' < in > out You can use the same thing in Ruby: string.tr!( '\r', '' ) Or, you can do it in vim: :%s/^M//g To get the ^M down there, use visual mode to select one of the ^Ms and yank it; then do :%s/ and type ^R" to paste it. Then finish the replace with //g, and voila. It might even work if you do: :%s/^V^M//g (^V in vim lets you insert control characters). Sorry if I'm telling you stuff about vim that you already know. If you're slurping the files with Ruby, the easiest thing is to use String#tr. If you're slurping the files with wget or curl, 'tr' is probably the easiest. --- SER