2

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?

5
  • related: How to convert DOS/Windows newline to Unix newline in bash script? Commented Dec 16, 2013 at 1: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... Commented Dec 16, 2013 at 1:38
  • 1
    I 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. Commented Dec 16, 2013 at 1:45
  • 2
    I've noticed that instead of replacing \r\n with \n, you want replace \r\n with \r. Is it correct? Commented Dec 16, 2013 at 1: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. Commented Dec 16, 2013 at 6:11

2 Answers 2

0

Yes. The name of the tools are:

fromdos

todos

They are in the package tofrodos in most distributions.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use the command dos2unix. The inverse is unix2dos, of course.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.