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.
Asked
Active
Viewed 2,074 times
0
-
2Would http://stackoverflow.com/questions/800030/remove-carriage-return-in-unix help? Would your question be a duplicate of that one? – VonC Apr 29 '10 at 06:01
1 Answers
0
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
- 81
- 1
- 1
- 11