From: Kaspar Schiess Date: 2004-06-09T19:39:14+09:00 Subject: Re: strip DOS ^Ms? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dick Davies wrote: | Me again. I have chosen one of the crappiest websites on Gods | green Earth to scrape here.... | | For no good reason I have buttloads of '^M's all over the file | when I check it in vi. What would I feed gsub to strip them out? | Otherwise I'm looking at a very very long regex to yank out the | fields I need.... | I recommend the tool suite called dos2unix unix2dos mac2unix unix2mac on unixes. They are even included in the msys toolkit. The ^M's are superfluous line returns (don't remember which of '\n' or '\r'). Just convert your file to unix line endings using dos2unix The CP-conversion tool recode also supports this. And every other editor. Actually gvim and vim seem to have the setting set ff=[one of 'dos', 'unix' or 'mac']. So just doing ':', 'set ff=unix' will initiate conversion. Don't gsub. That is the way to madness. kaspar semantics & semiotics code manufacture www.tua.ch/ruby -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFAxunDFifl4CA0ImQRAoCpAJ9rzJhh/fWtmoXrtguVn6xqBFiCmwCdGKOC Wb0CEe0AEVk2IwoSdG7PwKs= =OvJj -----END PGP SIGNATURE-----