#!/usr/local/bin/perl
# m2j - turn ^M to ^J to convert PC files to a form pleasing unto UNIX
#To turn ^M to ^J in all the files under foo, do
#find foo -type f -print | xargs m2j
# Author: 96/6/18 Carl Rigney cdr@livingston.com
for $FILE (@ARGV) {
$FILEBAK = $FILE.'.bak';
rename($FILE,$FILEBAK) || die "$0: unable to rename $FILE to $FILEBAK; $!\n";
open(FILEOLD,'<'.$FILEBAK) || die "$0: unable to read $FILEBAK; $!\n";
open(FILENEW,'>'.$FILE) || die "$0: unable to write to $FILE; $!\n";
while (<FILEOLD>) {
s/\015/\012/g;
print FILENEW $_;
}
close(FILEOLD);
close(FILENEW);
}