/ Published in: Bash
Maybe you know that dos2unix command (included in tofrodos package) makes the conversion between dos and unix text files. But, what if you don't want to install tofrodos package or dos2unix fails? That's the bash solution i found over the web.
Expand |
Embed | Plain Text
cp mydosfile.txt mydosfile.txt.bak tr -d "\r" < mydosfile.txt.bak > mydosfile.txt
Comments
Subscribe to comments
You need to login to post a comment.

installing tofrodos can be avoided by making use of a command called flip
Usage:
flip - do newline conversions between **IX and MS-DOS
-u Convert to **IX format (CR LF => LF, lone CR or LF unchanged, trailing control Z removed, embedded control Z unchanged).
-m Convert to MS-DOS format (lone LF => CR LF, lone CR unchanged).
A post about flip can be found here: http://unstableme.blogspot.com/2008/04/linux-flip-command-alternative-of.html
You could use vim to get the same result, just do
:set fileformat=unix