I use an old server without dos2unix
and I would like to convert files containing Windows-style end-of-line (EOL) to Unix-style EOL. I am unfortunately not the admin so I can't install dos2unix
. The tr
method seems to be the only one that works.
cp script _p4 && tr -d '\r' < _p4 > script && rm _p4
Are there any easier methods to do this?
dos2unix
is a small and relatively self-contained binary. There's a sporting chance it will work on your server. If you havedos2unix
installed on a machine with the same arch and OS (is this Linux?) then try copying it to your home directory and do./dos2unix file_you_want_to_convert
. Or, of course you could just download a suitable binary to the server directly.