Old stuff/Perl/recherche_dans_fichier_binaire.pl
(Deskargatu)
#!/usr/bin/perl -w
my $file="/usr/bin/yes";
my @stats = stat($file);
print "FILESIZE=".$stats[7]."\n";
open(INFO, "/usr/bin/yes");
binmode(INFO);
my $pos=0;
my $recherche="lib";
my $str_recherche = length($recherche);
my $data;
my $step_length=100;
while($pos<$stats[7])
{
seek(INFO, $pos,1);
read(INFO, $data, $step_length);
#print "GET ".length($data)."\n";
$pos+= $step_length-$str_recherche+1;
if($data=~ /$recherche/)
{
print "TROUVE !";
}
}