I have a set of big (>1Gb) binary files which was uploaded to FTP with incorrect line-ending. They contain "0D 0A" where should be "0D". Is there a way in Linux to replace all includings of bytes "0D 0A" to "0D" in command line?
Asked
Active
Viewed 674 times
2
-
related: [How to convert DOS/Windows newline to Unix newline in bash script?](http://stackoverflow.com/q/2613800/4279) – jfs Dec 16 '13 at 01:14
-
@J.F.Sebastian There is a difference between removing bytes and replacing, I would like to replace, not delete. And it is impossible to install non-standard utilities. Only sed, bash, tr is available... – Epsiloncool Dec 16 '13 at 01:38
-
1I don't understand your comment e.g., in what way `sed $'s/\r$//'` fails for you? There could be invalid for your use-case answers but the question is 100% related. – jfs Dec 16 '13 at 01:45
-
2I've noticed that instead of replacing `\r\n` with `\n`, you want replace `\r\n` with `\r`. Is it correct? – jfs Dec 16 '13 at 01:58
-
@J.F.Sebastian Yes, I wrote about I need for \r, but actually I am looking for relatively universal solution for replacement bytes. I've tried everything already and didn't get any positive result. But thanks, your comment would be best answer. – Epsiloncool Dec 16 '13 at 06:11