Admin-Ahead Community

General Category => General Discussion => Topic started by: Haripriya H on January 11, 2014, 01:03:20 pm

Title: How to remove ^M characters from a file
Post by: Haripriya H on January 11, 2014, 01:03:20 pm
Many time it happens that when you open a file  in vi editor  you see  a ^M character  at some places in  a file and a  ^M  character is nothing but a carriage return character in Linux.

You normally found those characters when you transfer a file from  a windows machine to a Linux box.

The   ^M character [Carriage Return] can easily be removed by following  one of the below method  ::

1 >  Using Perl



2> Using Replace Command



3> Using vi editor


:%s/\r//g

save and quit.