Home » , » Remove Control M' Characters (^M) with Unix and Linux commands

Remove Control M' Characters (^M) with Unix and Linux commands

Written By 1 on Wednesday, June 19, 2013 | 10:34 PM

Using dos2unix  command
dos2unix ORIG_FILENAME TEMP_FILENAME
mv TEMP_FILENAME ORIG_FILENAME
IMP NOTE: use dos2ux command if you are using HPUX
                    use dos2unix  command if you are using LINUX
Using sed command
sed ‘s/^M//g’ ORIG_FILENAME > TEMP_FILENAME
mv TEMP_FILENAME ORIG_FILENAME
IMP NOTE: To get ^M in UNIX (Hold control key and then press v and m character).  
Using vi Editor
ESCAPE   :%s/^M//g ENTER
IMP NOTE: To get ^M in UNIX (Hold control key and then press v and m character).

0 Comment:

Post a Comment