Find the answer to your Linux question:
Results 1 to 3 of 3
hay I feel a bit stupid, but I have a file and I would like to read it. Unfortunately I have no idea how. vi and gedit can't read it, ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    5

    How to read a file

    hay
    I feel a bit stupid, but I have a file and I would like to read it. Unfortunately I have no idea how. vi and gedit can't read it, but how can I find out what I need to read it?
    I can't attach the file to this message because the file type is not supported, but I put the file on my webpage if you want to have a look... (the file is called lcdm_gas_littleendian.dat)

    Florian Beutler-Hompage-

    thanks for any help
    regards
    florian

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Hello,

    there is no common standard for these kind of files.
    It consists of pure numbers written in a binary format by some program.
    All I can tell is that the numbers are written in the little_endian format.
    But what the data stands for depends on the specific program that wrote it.

    I assume this is some sort of spectra information from LCDM. If you got it from an online catalog, look closely at the instructions on the website. They often describe the format: "And in the first row, the frequency is stored as a 16 bit signed float, bla bla".

    With this info, you can import it with Octave or a C program in the next step.
    Debian GNU/Linux -- You know you want it.

  3. #3
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    You can also do some sleuthing with command od. I dumped the file in float, integer, octal, and character formats simultaneously. If you know roughly what you are looking for, you may be able to decipher enough of the format to do some reading. I thought it looked like a blocked binary record that Fortran might write.

    In general, I agree with GNU-Fan -- try hardest first to find the documentation.

    I think I may have had a utility that unblocked a file like that. I'll look around (but don't hold your breath, it's likely on a server that currently not in operation). Such a utility would be useful at times like this, strange that there isn't one that's part of the file command.

    This kind of situation demonstrates why people say ASCII (character) files are the universal interface. The binary files can be read faster than character files by at least an order of magnitude -- on the other hand, computers are very fast these days, and one does not need to worry as much about lack of portability for such files.

    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...