I have a .DAT file which is used by a DOS D-Fend Reloaded application. I know that these characters are somehow converted in dates by the program. Here is the selected part (from different lines) of the output of od -cv INFILE.DAT
006 \0 002 \0 { \a 024 \0 \b \0 312 \a \a \0 \t \0 312 \a
\a \0 004 \0 222 \a 037 \0 \b \0 312 \a 020 \0 \t \0 312 \a
\r \0 004 \0 250 \a \a \0 \t \0 334 \a 023 \0 \t \0 334 \a
but I have no idea of how it can be traced back to txt format
Your data is an octal dump from the
odutility. You can create a dump in the same format, of all the possible values of a byte, from 0..255, using this:That looks like this:
If you save the following
gawkscript as"func.awk"you can re-use it to convert an octal string to hex in any scripts:You can now use
gawkto process your octal file. As the fields in it are separated by spaces, you would lose the space at position 32, so I am usingFIELDWIDTHSof 4 to split your fields:That will then give you your file as hex, which you can pipe into
xxdand reconstruct your initial file:So, if I take the full 0..255 possible values in octal dump format from the very beginning of the answer, I can reconstruct it to binary like this:
If I then use
xxdto dump that, you can see all the values are recovered: