I was using the following option to clean up the ^M characters in a file that was FTPed from Windows:
- dos2unix
- sed 's/^M//g'
The ^M characters are removed but the last line is also getting removed. Any idea why this is happening.
Satish
I was using the following option to clean up the ^M characters in a file that was FTPed from Windows:
The ^M characters are removed but the last line is also getting removed. Any idea why this is happening.
Satish
Perhaps the last line didn't have a newline at all? That will interfere with some unix tools, many of which expect entire lines.
tr doesn't care about lines, though, so try this:
tr -d '\r' < inputfile > newfile
echo >> newfile
Thank you. That was the isssue.