^M character

can someone tell me what sed -e 's/^M$//' file will exactly do?
here ^M is not two diff characters but a single '^M' char

Removes the DOS carriage return character - ie, turns a DOS file into a UNIX file.
UNIX uses newline, DOS uses newline + carriage return

^M in one character is a Carriage Return, or ASCII 13 character.

That command will remove the ^M character from the end of every line in the input file.

dos2unix will do the same for you

True!
... If installed (not the case by default on all unix...)