Vim convert file from DOS to UNIX


DOS to UNIX

Here’s how to convert file dos.txt from DOS to UNIX using Vim.

Open dos.txt with the Vim editor:

$ vim dos.txt

Set fileformat to unix and write and quit the file:

:set fileformat=unix
:wq

This is equivalent to running the Vim commands from the shell:

$ vim '+set ff=unix' '+x' dos.txt

UNIX to DOS

Here’s how to convert file unix.txt from UNIX to DOS using Vim.

Open unix.txt with the Vim editor:

$ vim unix.txt

Set fileformat to dos and write and quit the file:

:set fileformat=dos
:wq

This is equivalent to running the Vim commands from the shell:

$ vim '+set ff=dos' '+x' unix.txt


Please support this site and join our Discord!