perl -0777pe 's/\R?$/\n/' file
-0777 is equivalent to no record separator (treat the whole file as a single line), so $ equals EOF not EOL.
\R is equivalent at CRLF (Windows) or LF (Linux) or CR (MAC).
perl -0777pe 's/\R?$/\n/' file
-0777 is equivalent to no record separator (treat the whole file as a single line), so $ equals EOF not EOL.
\R is equivalent at CRLF (Windows) or LF (Linux) or CR (MAC).