Skip to main content
4 of 4
`777` is the ”argument“ for `-0`
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).