FFF

How to remove ^M (Ctrl - M) Characters using Telnet or Putty in Windows ?

AddThis Social Bookmark Button
  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
 

Add comment


Security code
Refresh