Convert line endings [duplicate]

Some options: Using tr tr -d ‘\15\32’ < windows.txt > unix.txt OR tr -d ‘\r’ < windows.txt > unix.txt Using perl perl -p -e ‘s/\r$//’ < windows.txt > unix.txt Using 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.