in reply to Search hex string in vary large binary file
> 1. How can I read the file from disk?
use sliding window technique, you only need to hold at least twice the searched string in memory. see length argument in read
Though multiples of 4kb big chunks seems reasonable.
> And then 2nd how would I do a regular expression for binary instead of searching for text?
strings are just binaries, you just need to convert¹ your hex to them.
BTW: index may be a good alternative to regex
¹) e.g.
DB<115> join "", map {chr} 0x20,0x41,0x42 => " AB"
see also pack for a direct approach.
DB<123> pack 'H*', '204142' => " AB"
|
|---|