Extracting text from a binary file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    Extracting text from a binary file

    I have written a script to compare two "Load" directories and produce a difference report.

    Some of the .exe files that fail comparison have version control data (RCS) embedded with in them.

    Is there any way to extract this data into an external file for further comparison using BeyondCompare or do I need to preprocess the file before the start of the session ?

    BTW - excellent tool.
  • Zoë
    Team Scooter
    • Oct 2007
    • 2666

    #2
    Re: Extracting text from a binary file

    It depends on whether you're comparing the exes with the text comparison or the version viewer or hex viewer. If you're using the text viewer there's a couple of ways to do it. If you have a the version viewer or hex viewer associated with exes you'll need to preprocess the files externally.

    There's two ways you might be able to strip out the RCS data. In both cases you'll need to set up rules to control how BC compares exes. To start, open the file viewer and select New Rules... from the Tools->Pick Rules submenu. From there give the rules set a name and assocation (eg, "Exe files" and "*.exe").

    1) Mark the RCS data as unimportant. To do that switch to the importance tab and click the New button in the Unimportant Text. In the new dialog you'll either need to use the Delimited or Regular Expression category.

    2) Use the External Conversion support on the Conversion tab. You'll need to do the preprocessing here, but BC will call it automatically before comparing the files and store the conversion in a temporary location, so it's not modifying the real files.
    Zoë P Scooter Software

    Comment

    • Guest's Avatar

      #3
      Re: Extracting text from a binary file

      I would like to try your suggestion but first can you tell me where to find the External Conversion tab ?

      I am running 2.2.7.

      Comment

      • chrroe
        Pooh-Bah
        • Oct 2007
        • 588

        #4
        Re: Extracting text from a binary file

        Hi!

        Go to the Extras menu.
        Choose Options... .
        In the left overview click on Rules .
        Now create a new rule or edit an existing one.
        There must now appear a dialog-box with 4 Tabs:

        General, Importance, Alignment, Conversion

        It is always advisable to press the Help Button .



        Bye
        Christoph

        Comment

        • Guest's Avatar

          #5
          Re: Extracting text from a binary file

          I have created the new rule as you suggested but I am still unable to run the External conversion programme.

          To test the File conversion I have created a simple .bat file:-

          echo on
          echo text >> file.log

          The BC script is as follows:-
          # criteria crc
          criteria rules-based

          load %1%2 %1%3
          expand all

          filter -*.bcss;-*.html
          snapshot save-crc lt output:%1%2\%2.bcss

          filter -*.html
          # compare crc
          compare rules-based
          folder-report layout:side-by-side options:column-timestamp,column-size,column-crc output-to:%1%2\%2_Load_Comp.html output-options:html-color

          If execute the .bat directly the log file gets updated however this does not occur when running BC from the command line. The comparison o/p file is still produced.

          Can you see what I am doing wrong ???

          Comment

          • Chris
            Team Scooter
            • Oct 2007
            • 5538

            #6
            Re: Extracting text from a binary file

            The working directory for external converters is the Beyond Compare program directory, so you probably need to specify the full path for the output text file in your batch file.

            Also, it is probably easiest to start testing your external converter with an interactive comparison of two files in the File Viewer.
            Chris K Scooter Software

            Comment

            Working...