when a DOS file is transferred to a UNIX system, there is one more ^m at the end of each line, which may not be visible, but in the case of VI, theThe format of this file, such as "Dos.txt" [dos] 120L, 2532C, means a [DOS] format file, if it is a Macsystem, will show [MAC], because the file format causes sometimes cause our Unix program, or shell program error, then you need toto convert these DOS file formats into UNIX format, the method isVI Dos.txt
: Set Fileformat=unix
: wThis file is converted to a UNIX format file, generally written on the Windows machine files uploaded to Unix may appear thisthe case of a sample.with the command: set FF? You can see the Word dos or UNIX.
Use: Set Ff=unix to force it to UNIX format,It can also be done using tools such as sed:sed ' s/^m//' filename > Tmp_filenamewhere ^m is at the same time Ctrl+v+m pressed out, indicating carriage return.
DOS format file to Unix