Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 767 Bytes

2008-07-29-196.md

File metadata and controls

28 lines (23 loc) · 767 Bytes
date layout slug title tags location geo
2008-07-29 03:06:21 UTC
post
196
Converting line-endings with ViM
os/x
vim
line-endings
unix
Rusholme Park Crescent, Toronto, Canada
43.652095
-79.428583

I got my hands on a file containing OS/X line-endings (\r), which needed to be converted into Unix line-endings (\n).

Normally I would just do a simple search and replace, with:

:%s/\r/\n/g

Oddly enough, this actually gave me null-characters (0x00) instead of the expected \n. After some browsing, this seems to be the correct command:

:%s/\r/\r/g

I have no clue why, and this seems wrong to me, as this command should not have any effect (replacing \r with \r). But yea, it worked :S