#!/usr/sbin/perl -w
if ($] >= 5.0) {
    $target = $ARGV[1];
    while ( <> ) {
	if ( /$target/ ) {
	    last;
	}
    }
    while ( <> ) {
	chomp;
	/^\[[ 1234567890]+\][ ]*0x[ ]*/ ||
	    die "Unable to parse line after target \"$target\"\n\"$_\"\n";
	$' =~ /[1234567890abcdef]*:/ ||
	    die "Unable to parse line after target \"$target\"\n\"$_\"\n";
	$& =~ /[1234567890abcdef]*/;
	printf "0x$&";
	last;
    }
} else {
    $target = $ARGV[1];
    while (<>) {
	if ( /$target/ ) {
	    last;
	}
    }
    while ( <> ) {
	chop;
	/^\[[ 1234567890]+\][ ]*0x[ ]*/ ||
	    die "Unable to parse line after target \"$target\"\n\"$_\"\n";
	$' =~ /[1234567890abcdef]*:/ ||
	    die "Unable to parse line after target \"$target\"\n\"$_\"\n";
	$& =~ /[1234567890abcdef]*/;
	printf "0x$&";
	last;
    }
}
