Tuesday 30 July 2013

How To Remove ^M (Ctrl - M) Characters Using Telnet Or Putty In Windows ?

To Remove the ^M Characters follow these steps:

1.Open the Telnet or Putty

2.Go to the Corresponding Directory

3.Type the following in the Telnet or Putty and confirm the whether ^M (Ctrl - M) characters exists.

 vi filename

4.Type the following in the Telnet or Putty.

Perl -pi -e's/\r//g;'filename

Enter the corresponding file name instead of the word "filename". So the Control M characters will be removed for the file name given.

OR 

Perl –pi –e ‘s/\r//g;’ *

The above syntax will remove the Control M characters for all the files in that particular folder and not the sub folder.

5.Type the following in the Telnet or Putty and confirm the ^M (Ctrl - M) characters has been removed.

vi filename

No comments: