ASCII String Dump?

Discussion in 'Mac Programming' started by ArtOfWarfare, Aug 22, 2013.

  1. ArtOfWarfare macrumors G3


    Nov 26, 2007
    I'd like a utility that acts kind of like

    hexdump -c
    But instead of mixing in the ASCII with everything else, I'd like it to only print the ASCII.

    It could have a bit of intelligence, only considering something to be ASCII if it's part of a sequence that contains at least two alphanumeric ASCII characters.

    Then I would like it to insert line breaks between each sequence when it outputs it.

    I'd like this utility so that I can easily find all the ASCII strings any file contains (specially, I'd like to see what strings a .mpg contains and what a .dll contains - I'm trying to find a way of determining what codecs the .dll file recognizes, and I'm hoping that it involves some ASCII strings.)
  2. chown33 macrumors 604

    Aug 9, 2009
  3. ArtOfWarfare thread starter macrumors G3


    Nov 26, 2007
    Thanks. I had worked out an algorithm and started writing it in C but stopped when I saw your post. Interestingly, it looks like the algorithm they used produced the exact same results as mine (or at least my algorithm wouldn't have removed anything there's didn't.)

    I was assigning point values to characters. Symbols got 1 and alphanumeric got 2... everything else got 0. Contiguous sections of symbols and alphanumeric that added up to at least 4 would get printed, and a line break would be entered when it swapped from printing to not printing.

    But it looks like I need not implement it because someone else already did. Thanks!

Share This Page