views:

179

answers:

5

I have a compressed file. Let's ignore the tar command because I'm not sure it is compressed with that. All I know is that it is compressed in fortran77 and that is what I should use to decompress it. How can I do it? Is decompression a one way road or do I need a certain header file that will lead (direct) the decompression?

It's not a .Z file. It ends at something else. What do I need to decompress it? I know the format of the final decompressed archive.

Is it possible that the file is compressed thru a simple way but it appears with a different extension?

A: 

There is no standard decompression method, there are tons. You will need to know the method used to compress it in order to decompress it.

John T
Probably he means a file compressed with the shell tool "compress", i.e., a .Z file.
Mitch Haile
He specified it's not though =\
John T
Hrm, I don't think that sentence was there when I wrote the above... :-)
Mitch Haile
A: 

You said that the file extension was not .Z, but something else. What was that something else?

If it's .gz (which is very common on Unix systems), "gunzip" is the proper command. If it's .tgz, you can gunzip and untar it. (Or you can read the man page for tar(1), since it probably has the ability to gunzip and extract together.)

If it's on Windows, see if Windows can read it directly, as the file system itself appears to support the ZIP format.

If something else, please just list the file name (or, if there are security implications, the file name beginning with the first period), and we might be able to figure it out.

David Thornley
+1  A: 

First, let's get the "fortran" part out of the equation. There is no standard (and by that, I mean the fortran standard) way to either compress or decompress files, since fortran doesn't have a compression utility as part of the language. Maybe someone written some of their own, but that's entirely up to him.

So, you're stuck with publicly available compression utilities, and such. On systems which have those available, and on compilers which support it (it varies), you can use the SYSTEM function, which executes the system command by passing a command string to the operating system's command interpreter (I know it exists in cvf, probably ivf ... you should probably look it up in help of your compiler).

Since you asked a similar question already I assume you're still having problem with this. You mentioned that "it was compressed with fortran77". What do you mean by that ? That someone builded a compression utility in f77 and used it ? So that would make it a custom solution ?

If it's some kind of a custom solution, then it can practically be anything, since a lot of algorithms can serve as "compression algorithms" (writing file as binary compared to plain text will save a few bytes; voila, "compression")

Or have I misunderstood something ? Please, elaborate this a little.

ldigas
+1  A: 

My guess is that you have a binary file, which is output by a Fortran program. These can look like compressed files because they are not readable in a text editor.

Fortran allows you to write the in-memory data out to a file without formatting it, so that you can reload it later without having to parse it. The problem, however, is that you need that original source code in order to see what types of variables are written in the file.

If you have no access to the fortran source code, but a lot of time to spare, you could write some simple fortran program and guess what types of variables are being used. I wouldn't advise it, though, as Fortran is not very forgiving.

If you want some simple source code to try, look at this page which details binary read and write in Fortran, and includes a code sample. Just start by replacing reclength=reclength*4 with reclength=reclength*2 for a double precision real.

Phil H
This is my guess as well - it's probably an unformatted binary file.
Tim Whitcomb
A: 

You can check to see if it's a known compressed file type with the file command. Assuming file returns something like "binary file" then you're almost certainly looking at plain binary data.

Rick Reynolds