# -+- number -+- category -+- title -+- email -+- name -+- homepage -+- clickOnName -+- language -+- image -+- browser-used -+- security-cookie =0 -+- 2001-02-13:9 -+- UNIX Basics -+- Removing ^M from file -+- ismail@enderunix.org -+- Ismail YENIGUL -+- http://www.enderunix.org -+- email -+- English -+- -+- Mozilla/4.76 [en] (X11; U; FreeBSD 4.2-RELEASE i386) -+- 7064 if you have transferred a file from MS Windows to UNIX, you might find that the file looks like this:
bleh bleh ^M
leh leh ^M
tey tey tey^M

This is because Windows uses carridge return and newline to indicate a new line.
Here are a number of ways to get rid of the ^M characters:
1- cat filename1 | tr -d "^V^M" > newfile
2- sed -e "s/^V^M//" filename > outputfilename
where ^V is actually control-V and ^M is actually control-M (you must type these yourself, don't just copy and paste this command from this web page)
3-vi solution : open file with vi
   1. hit the ESC key
    2. :%s/^V^M//

3 - some distributions contain a command called dos2unix which removes these carridge return characters

4- use the texteditor vim (www.vim.org) and edit the file. If all the lines (not only some) contain consistently the carridge return characters then vim will show [textmode] and when you change the mode with the command
:set notextmode
it will remove them.