#/!usr/bin/perl use warnings; use strict; @ARGV or die "usage: $0 file\n"; my $file = shift @ARGV; open my $fh, "<", $file or die "unable to open file"; binmode $fh; # disable "\n" translation my $data; { local $/=undef; $data=<$fh>; } my $pattern=pack('CC', 0xff, 0xd9); my $at=index($data, $pattern); if ($at<0) { print "pattern not found\n" } else { print "pattern found at pos $at\n" }
In reply to Re: how to search binary file
by salva
in thread how to search binary file
by redss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |