Vim (vi improved) provides a rapid way to change the format from dos to unix and viceversa.

After you have opened your text file, just type the following command in vim:

:set fileformat=unix

to change the format to unix, or type:

:set fileformat=dos

to change the format to dos format, or type:

:set fileformat=mac

to change the format to Macintosh format.

You can also use the contract form for fileformat typing the following command:

:set ff=<format> (dos, unix, mac)


You can also do massive conversion using the shell and vim:

# vim +"argdo set ff=<format>" +wqa <file_list>

for example

# vim +"argdo set ff=<format>" +wqa *.c

This command will change the format for all c source code file in the current directory.