HOWTO: DOS to Unix

This keeps popping up from time to time at work, because I get input files created by someone else in Windows and I work with them in *NIX environments.

The DOS-format normally doesn’t bother me until sed/awk/grep/cut scripts break when unexpected characters appear. Editing in vim and replacing them with "%s/^M//g" normally works, but I found an elegant solution here:

:e ++ff=dos
:setlocal ff=unix
:w

How to convert DOS to Unix (and vice-versa, if ever!)

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