Mac · TechIt

Dos2Unix type conversion on Mac OS

Converting the line ending of a file on your Mac from dos or windows format to Mac format is as simple as

entering the following command in an iTerm terminal window.

tr '\r' '\n' file-with-mac-newline.txt

Or as oreng asserts
actually it should be :
tr ‘\r’ ‘\n’ < file-with-mac-newline.txt

I spent quite a while looking for a dos2mac type program, expecting to find dos2unix for the mac, when I came across the tr command that does just what I wanted.

Advertisements

4 thoughts on “Dos2Unix type conversion on Mac OS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s