How to remove ^M from a text file and replace it with the next line

Viewed 35732

So suppose I have a text file of the following contents:

Hello what is up. ^M
^M
What are you doing?

I want to remove the ^M and replace it with the line that follows. So my output would look like:

Hello what is up. What are you doing?

How do I do the above in Python? Or if there's any way to do this with unix commands then please let me know.

3 Answers
Related