Skip to content

Instantly share code, notes, and snippets.

@luelista
Created December 28, 2010 17:10
Show Gist options
  • Save luelista/757423 to your computer and use it in GitHub Desktop.
Save luelista/757423 to your computer and use it in GitHub Desktop.
prints IBM hex files in a formatted way
#!/bin/perl
# view_hexfile.pl
# prints IBM hex files in a formatted way
# Max Weller, http://max-weller.de
while(<>) {
if($_=~/^\s*:([A-F0-9]+)\s*$/) {
my @data = unpack("(A2)*", $1);
print $_," " for (@data);
print " | ";
for(@data) {
my $d = hex;
print ($d<32||$d>128?".":chr $d)," ";
}
print "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment