in reply to convert files unix2dos using perl script

perl -i.bak -pe 's/\012/\015\012/g' infile

Courtesy to "format_c" and others at perl-community.de

Update:
Come to think of it, the funny thing is, transferring the files in ASCII mode should actually have taken care of the newline translation: that's what I believed that mode was for. Maybe your ftp client or the host's ftp server have a bug there.

Cheers, Sören

  • Comment on Re: convert files unix2dos using perl script

Replies are listed 'Best First'.
Re^2: convert files unix2dos using perl script
by jfroebe (Parson) on Jun 21, 2004 at 03:20 UTC

    It depends on the files whether the auto mode of many of the ftp clients will choose to use ascii or binary mode. The detection isn't always full proof especially with mixed files (i.e. some Word docs).

    Jason L. Froebe

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1