Unix2dos: Difference between revisions
From Leo's Notes
This page was last edited on 15 June 2020, at 00:10.
Created page with "A newline is denoted with different control characters depending on the operating system you are on. Linux denotes newlines with a line feed ({{code|LF}}, denoted typically a..." |
|
(No difference)
| |
Revision as of 00:10, 15 June 2020
A newline is denoted with different control characters depending on the operating system you are on.
Linux denotes newlines with a line feed (LF, denoted typically as \n.
Windows and DOS denotes newlines with both a carriage return and a line feed (CR LF), denoted typically as \r\n.
Conversion
On Linux, use any one of:
## From \r\n to \n:
$ dos2unix
$ cat file.txt | tr -d '\r' > file2.txt
## From \n to \r\n:
$ unix2dos