Notice: Unexpected clearActionName after getActionName already called in /var/www/html/includes/context/RequestContext.php on line 338
Unix2dos - Leo's Notes

Unix2dos

From Leo's Notes
(Redirected from Newline)
This page was last edited on 15 June 2020, at 00:13.

Unix2dos is a utility that can convert the newline endings between Unix like systems (Linux, MacOS, BSD, etc.) that uses \n and DOS like systems (DOS, FreeDOS, Windows) that uses \r\n.

The conversion is necessary when dealing with files across these two platforms where the new line endings are important such as when dealing with scripts.

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