One annoying thing with text file is that files created on DOS/Windows machines have different line endings than files created on Unix/Linux. DOS uses carriage return and line feed \r\n
as a line ending which Unix uses just line feed \n
. So in the end you finish with a lot of supernumerary CTRL-M characters. To get rid of it you can:
Use sed
sed -e "s/^M//" filename > newfilename
Use vi
Inside vi [in ESC mode] type: :%s/^M//g
To enter ^M, type CTRL-V, then CTRL-M (hold down the CTRL key then press V and M in succession).
Use dos2unix
dos2unix filename