Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
perl -0777pe 's/\R?$/\n/' file
-0777 without arguments is equivalent to no record separator (treat the whole file as a single line), so $ equals EOF not EOL.
-0777
no record separator
$
EOF
EOL
\R is equivalent at CRLF (Windows) or LF (Linux) or CR (MAC).
\R
-0777 is equivalent to no record separator (treat the whole file as a single line), so $ equals EOF not EOL.
-00777 without arguments is equivalent to no record separator (treat the whole file as a single line), so $ equals EOF not EOL.
-00777
-0 without arguments is equivalent to no record separator (treat the whole file as a single line), so $ equals EOF not EOL.
-0
perl -0pe0777pe 's/\R?$/\n/' file
perl -0pe 's/\R?$/\n/' file