h1

Setting all line endings in a DOS file to UNIX

September 13, 2012

If you have a nasty DOS file and you wish to convert the it from any mixture of CRLF/LF-only line endings, so all lines end with LF only:

Save any changes.
:w

Edit file again, using dos file format (‘fileformats’ is ignored).
:e ++ff=dos

This buffer will use LF-only line endings when written.
:setlocal ff=unix

Write buffer using unix (LF-only) line endings.
:w

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: