Discussion Locked

unzip a text file in unix

0 helpful
22 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a text file gzipped in unix. i have ftped the file to windows (in text mode and not in binary mode). now i am unable to unzip the file back in unix

22 replies

by insatiable

Are you able to ftp it back to the Unix system and gunzip it there? I'm not sure if Windows can unzip a Unix file.
Good luck! :-)

by bakshikishore

i am able to ftp back to unix in binary mode but it gives an error "Segmentation fault (core dumped)" - when i do it in text mode it gives an error "unexpected end of file". winzip gives an "invalid format"

by sriram_som

To my knowledge, FTP doesn't do any thing on the source file (for that matter to zip files). Check whether do you have write permissions to the source file you are trying to zip and then unzip. But, it is always recommended to ftp a file in binary mode than ascii mode!

by prashantattray

There is something wrong with the permissions of the file. It should work perfectly fine if you have the read and write permissions on the file. It doesnt matter even if its in ascii mode.

by bowieb

When you gzip a file, it becomes a binary file regardless of what it was before. When you ftped it in text mode, you corrupted the file. You will have to go back and ftp it in binary mode. Text files can be ftped in binary with only minor problems, but binary files ftped in text mode will always get screwed up.

Winzip has no problem opening gziped unix files in Windows. I do it all the time.

by chris.welsh

Try ftp in binary (type "bin" in ftp) as a zipped or tar file is in binary format, regardless of what it contains......

good luck
Chris

by bowieb

If I understand you properly, this is what happened.

1) You gziped a text file in unix.
- This file should be fine
2) You ftped it to windows in text mode.
- As of now, this file is useless.

So...If you have the original text file, or the original gzipped file on unix, you can recover from there. If you don't have either of those, you're out of luck. Once you transferred the gzipped file in text mode, you corrupted it and will be unable to read it anywhere.

by johan

You might correct this problem by transferring it back to unix with ftp in textmode. Hopefully the translation of to will be undone. If there were any in the original zipped unix file, this will not work.
So send it back to Unix with ftp in textmode and try to unzip it with the unix gzip. If this works transfer it back to windows using binary mode. The Winzip program or any other zipper will be able to unzip it for you.

by jay allen

Well...You might be out of luck. Let summize the situation. You gzipped a file on Unix and ftp via ascii to Windows. Winzip didn't like the file so you ftp back to Unix. I am assuming the same directory therefore over the same file. Now as said early, ascii in good for 'pure text' files. Once the file is gzipped then it is not 'pure'. Therefore the ftp utility corrupted the file and then ftped it back copying over the original file which is now corrupt. So...If this is the case then you are just out of luck. I too have done the exact same thing.

by gazz

Did the Windows box change the look of the file and extension?
If the file in unix was myfile.gz
Opened in windows looked like MYFILE.GZ
Brought back to unix MYFILE.GZ or myfile.GZ or myfile.gz.ZIP
You might have to rename the file back to myfile.gz to unzip it.

Good luck????..

by oliviu

Use ftp in binary mode when you transfer the gzipped file.
I suppose you need to uncompress the file in windows (why did you ftp it?).
For windows use the same utilities (gzip and gunzip). I have them and I can send them to you if this is the case.

This discussion is closed to new replies.