FTP'ed in ASCII a word file, how to recover

This is my worst nightmare in recent years!!!

I spent two days writing a proposal due tomorrow, ftp'ed the Word doc to a Unix machine in ASCII mode (i forgot to turn BIN on). Then I was trying to help a colleague download it and I accidently download the ASCII file back to the same dir on my local PC, overwriting the orginal good Word doc. Now Word cannot open it.

Can I use dos2unix on the Unix box, save it as abc.doc and then BIN ftp into my local PC for Word to open it? WIll that work? I am desperate, Any help is much appreciated.

-Venki

The difference between ASCII and binary mode is that the Unix-style line endings (LF) get changed to DOS-style line endings (CR/LF). You can either use dos2unix (or vice versa) to correct this, the tool recode (man recode) is another possibility or even sed is possible:

cat dos_encoded_file | sed 's/^M$//' > unix_encoded_file
cat unix_encoded_file | sed 's/$/^M/' > dos_encoded_file

"^M" is CTRL-M and can be entered by (in vi-mode) pressing CTRL-V first and CTRL-M then.

Hope this helps.

bakunin