#! /usr/bin/perl -w use strict; # Convert the output of 'od -tx1 -Ax' back to binary. The input is expected # to look like this: # # 000000 eb 58 90 4d 41 4b 45 42 4f 4f 54 00 02 08 40 00 # 000010 01 00 00 00 00 f8 00 00 20 00 40 00 00 00 00 00 # [...] binmode STDOUT; my $index = 0; my $prevblock; while (<>) { chomp; next if $_ eq '*'; if (s/^([a-z0-9]+)(?:\s+|$)//) { my $lineindex = hex($1); while ($lineindex > $index) { die "no previous block!" unless defined $prevblock; for my $hex (split ' ', $prevblock) { print chr(hex($hex)); ++$index; } } } for my $hex (split) { print chr(hex($hex)); ++$index; } $prevblock = $_; }