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
, 32596 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.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.