Thursday, March 4, 2010

[Level 1] Remove ^M by vi.

When you got a text file from Windows, you will see " ^M " at the end of the line.
That's because Windows use " CrLf " for line end, but OpenSolaris only use " Lf ".
If you want to remove ^M, you can use the command in last line mode of vi.

:1,$s/\r$//

Wish this helps.

regards,
Stanley Huang