Paul - The Programmer

simple & stupid
Hide Vim menu bar and tool bar
Convert file format from dos to unix

Detect file format is dos or unix

paul posted @ Fri, 25 Feb 2011 04:34:21 +0800 in coding life with tags shell vim file format , 32401 readers

Detect file format with grep.

$ grep '^M'  your-file-name

^M is Ctrl-V + Ctrl-M. If the grep returns any line, the file is in DOS format.

Detect file format with vim.

1) Open the file with vim.

2) Use the vim set command to show the file format.

:set ff?

The command returns fileformat=<dos/unix/mac> to indect current file format.



Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Login *

loading captcha image...
(type the code from the image)
or Ctrl+Enter