I have been using d2u
to convert line endings. After installing Puppy Linux I
noticed that it does not come with d2u
, but dos2unix
. Then I noticed that
Ubuntu is missing both by default.
What is another way to convert line endings?
Some options:
tr
tr -d '\15\32' < windows.txt > unix.txt
OR
tr -d '\r' < windows.txt > unix.txt
perl
perl -p -e 's/\r$//' < windows.txt > unix.txt
sed
sed 's/^M$//' windows.txt > unix.txt
OR
sed 's/\r$//' windows.txt > unix.txt
To obtain ^M
, you have to type CTRL-V
and then CTRL-M
.