#!/usr/bin/perl # # Converts LF, CR and CRLF line endings to the local line ending. # # Usage: # fix_line_endings infile > outfile # fix_line_endings < infile > outfile # perl -i.bak fix_line_endings file (In place) # use strict; use warnings; my $file = do { local $/; <> }; $file =~ s/\x0A|\x0D\x0A?/\n/g; print $file;