[Techtalk] get rid of "^M" in a file

jett charnchoochai bitswrangler at gmail.com
Fri Jun 17 08:50:45 EST 2005


tr command on linux would do the job. 

[jett at norbert]$ tr '\r' '\n' < macfile.txt > unixfile.txt

-jett

On 6/16/05, Gebhard Dettmar <gebhard.dettmar at student.hu-berlin.de> wrote:
> On Thursday 16 June 2005 02:03, Noir wrote:
> > I have a file (.vimrc) which was in Windoze and now at
> > the end of each line of the file I have a "^M" which
> > is (obviously) generating lots of errors while
> > executing vim.
> Did I get this right, you see those ^Ms in vim? Is there some setting in
> your .vimrc to show dos carriage returns in vim?
> I just see it with less -u but not in vim on my machine. When I edit a
> html-file on the webserver of my University in vi, I do see them. So in
> vim on my machine I cannot replace them.
> BTW, I can't think of problems caused by carriage returns in vim, but I
> last year I had a problem executing a configure-script for my Winmodem
> drivers, posted it to techtalk and IIRC Devdas and Almut got the solution:
> ^M made of the shebang #!/bin/sh\r, which gave me the error-message 'Bad
> Interpreter: no such file or directory'. I had downloaded the tarball on
> Windows with either IE or WS_FTP (can't remember)
> > I want to get rid of all the "^M". I can hand-hack it
> > but that sound inefficient. I wanted to use "flip -u"
> > but the OS I am currently in doesn't have that.
> You can avoid this on Windows in the future by using e.g. TextPad
> (www.textpad.com - it's shareware but such a great editor: Perl-like
> Regexes + Posix, editing multiple files etc. I really miss this in Linux)
> and choose 'Unix' as filesystem when saving your files
> > Is there anything else I can use to get rid of that?
> >
> > TIA.
> > .noir
> regards gebhard
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://linuxchix.org/cgi-bin/mailman/listinfo/techtalk
>


More information about the Techtalk mailing list