amparida has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Can anyone help me to convert hex file into text file? Now when i convert hex to text file(copy all content to another file with extension txt), while opening it is giving junk values. Regards, Am

Replies are listed 'Best First'.
Re: Convert hex file to text file
by roboticus (Chancellor) on Sep 13, 2013 at 01:00 UTC

    amparida:

    I think you mean you have a binary file, rather than a hex file.

    If you want to get meaningful information from the file, you need to know what *type* of binary file it is--unless you'd be satisfied by just changing the binary bytes into their hex representation. Then you'd be able to open the file, but it would still be gibberish.

    If you're on a *nix box, you should have a "file" command which will look at the file and try to identify the file type for you.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Re: Convert hex file to text file
by uday_sagar (Scribe) on Sep 13, 2013 at 05:04 UTC

    Hi Amparida,

    I don't think this is the right place to ask this question.

    However, If your machine is Windows you have notepad++, gvim or vi for unix/linux and TextMate for Mac to view hex files without any distortion!

Re: Convert hex file to text file
by Marshall (Canon) on Sep 13, 2013 at 05:20 UTC
    There are a number of binary files that just do not convert easily into ASCII or other printable charters, even if the text is understandable text in another language. That is "what it is". Some characters take 2 or even 3 bytes of binary and that depends upon the encoding an language. Cheers, Marshall
Re: Convert hex file to text file
by BillKSmith (Monsignor) on Sep 13, 2013 at 12:25 UTC
    I am sure that you would get a better answer if you tell us more about the file and why you want to convert it.
    Bill