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


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users FTP'ed in ASCII a word file, how to recover
# 1  
Old 07-27-2005
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
# 2  
Old 07-28-2005
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

FTP stuck in 150 ascii after executing command

Hi, We have 2 linux RH servers (Server A and Server B), that were configured the same way. Same OS version, same ftp client, etc. The ftp client that we had installe, was downloaded from rpmbone site and the filename is: ftp-0.17-53.el6.x86_64 The permissions were already set up... (1 Reply)
Discussion started by: cees09
1 Replies

2. Shell Programming and Scripting

Convert Hex to Ascii in a Ascii file

Hi All, I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting? Thanks in Advance (2 Replies)
Discussion started by: HemaV
2 Replies

3. UNIX for Dummies Questions & Answers

After Ftp'ing file to destination how to check the file if it is in correct ASCII and not corrupted

Hi Folks, While transferring file from FTP software like Filezilla the files gets corrupted. Is there any way I can check if the recently transferred file is in ASCII and not corrupted. I have tried using file -i filename command which does tell if the file character set is ASCII or binary... (6 Replies)
Discussion started by: Khan28
6 Replies

4. Shell Programming and Scripting

FTP Issue with Non ascii character

I have one file .dat file on windows server containg the following text "Bürki" Now When I am using FTP (get) command from UNIX server the text is appering is as "Bürki" I want to preserve the text in the file on UNIX server as it is in source file. Could you please suggest some... (2 Replies)
Discussion started by: Bhushan D
2 Replies

5. Shell Programming and Scripting

To read data word by word from given file & storing in variables

File having data in following format : file name : file.txt -------------------- 111111;name1 222222;name2 333333;name3 I want to read this file so that I can split these into two paramaters i.e. 111111 & name1 into two different variables(say value1 & value2). i.e val1=11111 &... (2 Replies)
Discussion started by: sjoshi98
2 Replies

6. UNIX for Dummies Questions & Answers

ascii FTP from Linux to Linux adding carriage returns

Hi, I've got an issue with a shell script that FTP's a file from one Linux server to another Linux server. My script runs on a Linux server and creates an output file (from a database call), and then FTP's this file to another Linux server. The problem is that, even though the output file... (0 Replies)
Discussion started by: roysterdoyster
0 Replies

7. Shell Programming and Scripting

ftp - determine ascii or binary file

Hello, How to i determine via ftp commandline if files on ftp server is ascii or binary files. Like every other comon windows ftp program does it automatically. regards Thomas (5 Replies)
Discussion started by: congo
5 Replies

8. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

9. UNIX for Advanced & Expert Users

Ftp :bin and ascii

Hi , I am trying to ftp a file once using ascii mode and once binary mode The ftp prompt shows different bytes transferred for each of them but at the destination server,each one of these files gets created with the same byte size and are identical.Can anyone shed any light on this ... (1 Reply)
Discussion started by: smehra
1 Replies

10. UNIX for Dummies Questions & Answers

word count ascii files

how do I display the total number of words in a file which is of the type ascii text (1 Reply)
Discussion started by: madtim
1 Replies
Login or Register to Ask a Question