To remove all end of line characters (displayed as ^M), in VI type command: %s/CTRL-V CTRL-M//g

command will appear like following in VI :

:%s/^M//g