To Remove the Control Characters (^M) from File in Linux/UNIX do the following Steps:
1- Check the file first (You will see ‘^M’ on the end of each line): #cat -vte filename
2- open the file : #vi filename
3- press ESC button on Keyboard then press “:” (Command Mode)
5- write the following “1,$ s/^M//g” (HINT: to write the ‘^M’ char on step Number 5, just press “CTRL+v+m”)
6- save the file using “:wq”
7- check the file again: #cat -vte filename
Leave a Reply