tags:

views:

172

answers:

1

I have a file in Unix in which I am getting carriage return (^M) followed by linefeed.There are many other newline (enter) within the file which are not followed by linefeed.I want to remove this carriage return (^M) followed by linefeed such that other newline which are not followed by linefeed are not affected .Can you please suggest any command for this. Thanks in advance.

A: 

Open the file using vi editor, type :%s@$@@g

This will remove the Control-M characters only at the end of every line.

or

use the below perl syntax

perl -e 's/\r//g' -w -p -i

To view the Control-M characters, use vi -b

prasankn