I have been asked to show how to translate line feeds between Mac, UNIX, and Windows. This comes up often so here is one way using PERL which was designed to do just what we need.
- How to translate Mac OS file linefeed to UNIX linefeeds:
perl -pi -e 's/r/n/g' file_with_mac_linefeeds.txt
- How to translate UNIX file linefeeds to Mac OS linefeeds:
perl -pi -e 's/n/r/g' file_with_unix_linefeeds.txt
- Translate a Windows file linefeeds to UNIX linefeeds:
perl -pi -e 's/rn/n/g' file_with_win_linefeeds.txt
- Translate Windows file linefeeds to Mac OS linefeeds:
perl -pi -e 's/rn/r/g' file_with_win_linefeeds.txt
I hope this is a real time saver. Let me know!