#!/usr/bin/perl -w

use strict;

my $BLOCK_SIZE=1024;

my $fname = $ARGV[0];
open(F,"<$fname") or die("Unable to open file $fname, $!");
binmode(F);
my $buf;
my $ct=0;

while(read(F,$buf,$BLOCK_SIZE,$ct*$BLOCK_SIZE)){
	foreach(split(//, $buf)){
		if (ord($_) == 10){
			print "\n";
		} else {
		printf("%02x ",ord($_));
	}}
	print "\n";
	$ct++;
}
close(F);
