I am using the following sed command to knock off <Ctl> M characters(ASCII 13 characters)
in text files.
cat input.txt | sed s/^M//g > output.txt
where ^M character is generated by typing <Ctl>V followed by a <Enter>.
It is removing Ctl M characters successfully, but the only
problem is that it is also removing the last character in the text file
if there are no new line characters after it.
For example, the following text where } is the last character
WITHOUT a new line after it,
gets converted into,
Note that not only ^M characters, but also the last character { has been removed.
Any idea why this is happening?
in text files.
cat input.txt | sed s/^M//g > output.txt
where ^M character is generated by typing <Ctl>V followed by a <Enter>.
It is removing Ctl M characters successfully, but the only
problem is that it is also removing the last character in the text file
if there are no new line characters after it.
For example, the following text where } is the last character
WITHOUT a new line after it,
Code:
package com.test.mediator;^M
^M
public abstract class AbstractMediator implements MediatorIf {^M
}
gets converted into,
Code:
package com.test.mediator;
public abstract class AbstractMediator implements MediatorIf {
Note that not only ^M characters, but also the last character { has been removed.
Any idea why this is happening?