#!/usr/bin/perl
#--------------------------------------------
# Display file in PCTOOLS ASCII mode
#--------------------------------------------
$file1 = $ARGV[0];
$size1 = -s $file1 ;
open(FILE1,"<$file1") or die "Input file: Cannot open file\n\n";
$i = 0 ;
$j = 0 ;
while ($i < $size1 )
{
$ch = getc(FILE1);
$part1 = $part1 . ' ' . $ch ;
$part2 = $part2 . ' ' . ord($ch) ;
$i ++ ;
$j ++ ;
if ($j==20)
{
$part1 =~ s/\n/\*/g ;
$part1 =~ s/\r/\*/g ;
$part1 =~ s/\t/\*/g ;
print $part1 . ' ' . $part2 . "\n" ;
$part1 = '' ;
$part2 = '' ;
$j = 0 ;
}
}
if ($j>0)
{
$part1 =~ s/\n/\*/g ;
$part1 =~ s/\r/\*/g ;
$part1 =~ s/\t/\*/g ;
print $part1 . ' ' . $part2 . "\n" ;
}
close(FILE1);
|
|