Asked • 05/21/19

How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script?

How can I programmatically (i.e., not using `vi`) convert DOS/Windows newlines to Unix? The `dos2unix` and `unix2dos` commands are not available on certain systems. How can I emulate these with commands like `sed`/`awk`/`tr`?

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.