Remove '^M' in each line of files

Hi All,

Working on AIX 5.3

we need to remove '^M' in each line of files.

could anyone please share such an experience would be appreciated.

Thanks for your time!

Regards,

Do the following

1) vi the file

type this :%s/^M//g

To get ^M you hold down the CTRL key, press V then while still holding CTRL, press M.

Thnx so much bn_unx ...it works!!!

Regards,

there should be an extra program to convert the files called "dos2unix"...

The "^M" at line endings are a leftover from DOS/Windows: DOS encodes a line ending by a carriage return character followed by a line feed character - CR,LF.

Unix, on the other hand, ends lines with a newline character, thats all. The problem usually arises when files are being transferred (via ftp or otherwise) between the two types of systems.

To avoid it use the "ascii" mode in ftp which will change all the line endings properly for the respective system. In fact this is the difference between "binary" and "ascii" transmission mode in ftp.

I hope this helps.

bakunin

use this if ur file name is "file1" and new correct file name is "file2":
tr -d '/015' file1 file2

sorry for above is slighty incorrect try this will work:
tr -d '\015' < file1 > file2

I dont see "dos2unix" command in AIX.

$ man dos2unix
Manual entry for dos2unix not found or not installed.

is it "dos2aix"?

i checked with your suggestion.But i dont think so that command name should change,as it is same in solaris. anyway same ans.

$ man dos2aix
Manual entry for dos2aix not found or not installed.