Wednesday, 28 September 2011

To remove ^M in a file while editing it in vi Editor


To remove ^M in a file while editing it in vi Editor 


:%s/^M//g


to type ^M use following key sequences [ ctrl+v and ctrl+m]


alternatively, you can use below perl script to remove ^M characters from multiple files



find . -name '*.txt' |xargs perl -pi -e 's/find/replace/g'

No comments:

Post a Comment