Remove a ^M character

Hi,
I'd like to ask for some help with the following:

I've cut a couple of columns of file1 to create file2 with the following code:
cur -f 1,3,8 file1 > file2

Then I need to transfer file 2 from UNIX to Windows and use it further.
Unfortunatelly, for some reason the line is displayed as two fields in one line and then the third one is in separate new line. Something like this:
filed1 filed3
filed8
filed1 filed3
filed8
etc

When I tried to look at the file in Unix the the code:

less-l file2

it write this:

filed1 filed3^M filed 8

I tried to get rid of the "^M" by the following code:

replace "^M" " " -- file2

But nothing happens.

Could anybody help me to get rid of it and have mine three fields in one line, please?

Your help will be grteatelly appretiated!

Many thanks in advance!

Hello!

This question has been asked and answered numerous times!

Per forum rules, and the benefit of all users, please search the forums before posting a question.

You can easily search the forums using our internal Google search engine or our advanced internal search engine. You can also search our huge UNIX and Linux database by user generated tags or search the database for unanswered questions and provide an answer.

Thank you.

The UNIX and Linux Forums

I apologize!

One way to remove the carriage-returns:

cat filename | tr -d '\r' > new_filename

To check your original files to see whether that is where the carriage-return came from.
The carriage returns show as "\r" , the line feeds show as "$".

sed -n l original_filename

The text file line terminator in MSDOS is two characters "cr/lf", wheras on unix it is one character "lf". When transferring files to/from MSDOS systems it is important to know this and to either convert the file in transit (e.g. with text file FTP) or to convert the file on one of the servers.

Many thanks Methyl!!!!!
You can not imagine how much easier you made my life!!!!!