Date: Wed, 8 May 2002 12:44:56 -0500 (CDT) From: Jason P Holland <jholland@cs.selu.edu> To: questions@freebsd.org Subject: RE: such a pain Message-ID: <Pine.LNX.4.44.0205081243450.27010-100000@cs.selu.edu> In-Reply-To: <BBDEEDD2EB67D311A0240008C74B93453A912A@ntxmidcity.sdccd.cc.ca.us>
next in thread | previous in thread | raw e-mail | index | archive | help
> > > > Hi, > > > > I have some .c files which I got from my windows > > machine.But when I read > > > > it on BSD,for every line end ^M shows up,whereever there is a > > > > newline(carriage return).It is tedious to remove them > > manually.I have no > > > > X installed on my BSD.Can anyone suggest how to get rid of them? > > > > > > > > shubha > > > > > > In BSD, open the file with the vi editor > > > > > > vi <filename> > > > > > > Once you have it there type > > > > > > :%s/ctrl +V ctrl+ M//g > > > > > > That will do it. > > > The ctrl + V tells it to enter the next character > > > literally---otherwise, the ctrl + M wouldn't show up. > > > > You may also want to try dos2unix, it's worked to remove > > those pesky ^M's for me. > > > > #dos2unix file.txt > > > > It's located in /usr/ports/converters/unix2dos/ > > > Next time, when you FTP them , send them in ASCII mode. By default most > windows FTP clients send files in Binary mode. This has nothing to do with > the files being binary or ASCII text, rather the FTP clients will strip the > "/r" or carriage return from the end of the line for you. > > in later versions of vi and vim, you can also :se ff=unix that works for me. but dos2unix is nice if you have an older version of vi that doesn't support it. jason To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0205081243450.27010-100000>