Git Fatal CR LF Fix
UNIX to DOS (adding CRs)
sed -e 's/$/\r/' inputfile > outputfile
DOS to UNIX (removing CRs)
sed -e 's/\r$//' inputfile > outputfile
Convert to DOS
perl -pe 's/\r\n|\n|\r/\r\n/g' inputfile > outputfile
Convert to UNIX
This one works for Mac.
perl -pe 's/\r\n|\n|\r/\n/g' inputfile > outputfile
Convert to old Mac
perl -pe 's/\r\n|\n|\r/\r/g' inputfile > outputfile
Written by Victor Kristof
Related protips
2 Responses

why not use dos2unix
or unix2dos
?!
over 1 year ago
·

@MrBlue Ok if you're on Windows. I'm on Mac though, so I was mainly interested in this problem for Mac systems. Thanks for the comment.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#