Shell command to strip out ^M characters from text file
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
.
OR
dos2unix infile.txt file2.txt ....
OR
man dos2unix
for more details.