Jul 03

vi: Get rid of Windows formatted linebreaks (^M)

Tag: Fedora, FreeBSD, Linux, Ubuntujs @ 11:10 am

If you’ve ever tried to edit a Windows-created file in Unix or OSX, you’ve probably encountered a messy translation in line breaks: A file full of “^M” characters. There is an easy search/replace you can use in vi/vim to format the file Unix-style:

:%s/\r/\r/g
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Leave a Reply