#!/usr/bin/perl -w # (c) January 2000 Thomas Guettler http://www.thomas-guettler.de # This script is in the public domain # Feedback welcome # # Usage: cat broken_dos_file.txt | dos2unix.pl > new_file.txt # # Removes all \r\n to \n # I was able to restore a 15 MByte file which was downloaded in # ascii mode. But the restoring of binary files is not save since # \r\n is valid in binary files. while ($line=){ #old: $line =~ s/\r\n/\n/g; $line =~ s/\015\012$/\012/; print($line); }