Possible duplicate:Delete carriage return on Unix
I am reading some data created by a third-party third party. I noticed that the ASCII text in the file alternates with ^ M characters, which I believe is 13 in ASCII and represents a carriage return without a line break.
Is there one liner that I can use to remove ^ M characters from a file?
I work on Linux (Ubuntu).
You can use sed as follows:
sed -i.bak 's/^M$//' infile.txt
To enter ^M , you need to enter CTRL-V and then CTRL-M .
^M
CTRL-V
CTRL-M
OR
dos2unix infile.txt file2.txt ....
man dos2unix
for more details.
Ihth