Remove DOS line endings from Text files (CR/LF)

From Tech-Wiki
Revision as of 21:19, 23 June 2019 by Fabricio.Lima (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

dos2unix is a command line utility that will do this.

Or in vim you can use:

:%s/\r/\r/g  or
:%s/^M//g  use Ctrl-v Ctrl-m to input the ^M
:set fileformat=unix
sed 's/^M$//' windows.txt > unix.txt
sed 's/\r$//' windows.txt > unix.txt
tr -d '\r' < windows.txt > unix.txt