Shell command to strip out ^M characters from text file
awk, grep, linux, regex, sed
Solution
You can use sed like this:
sed -i.bak 's/^M$//' infile.txt
To type `^M`, you need to type `CTRL-V` and then `CTRL-M`.
Problem
Possible Duplicate: Remove carriage return in Unix I am reading some data generated by an external third party. I have noticed that the ASCII text in the file is interspersed with ^M characters, which I believe is character 13 in ASCII and represents a carriage return without linefeed. Is there a one liner I can use to strip the ^M characters from the file? I am running on Linux (Ubuntu).