Removing control-Ms (^M)

Anyone know how to remove ^M's from a text file using sed command?

You just have to remove the last character since its the last ...

sed -e 's/.$//g' file > file2

No, i'm returning a record from the DB, and one of the fields has ^Ms contained within it. This means it won't be the last character unfortunately.

sed 's/^M// file    # Press Ctrl-V then Ctrl-M to get ^M

for anyone that wants to know i found a different piece of code to use

#*********************************************************
# CHANGE LOG:
# DATE PERSON COMMENT
# ----------- ----------- -----------
# 28 FEB 2006 DARREN KANE CREATED
#*********************************************************

FILE=$1

/bin/tr -d '\015' < $FILE > t.$$
/bin/mv -f t.$$ $FILE

unix2dos
dos2unix

or, dependant on your system

ux2dos
dos2ux