Thursday, July 5, 2012

How to remove ^M (Control M) from the file which came from Windows

How to remove ^M (Control M) from the file which came from Windows
Use any of the beow steps.
1.
  > dos2unix <file_name>
Note: This only works when dos2unix rpm is installed



2.
  > open the file in vi editor
  > In colon mode
  >:%s/<ctrl v><ctrl m>//g
  > save it

3.
  > open the file in vi editor
  > In colon mode
  > :set fileformat=unix
  > save it with :wq

No comments:

Post a Comment