[ale] Binary Grep

James P. Kinney III jkinney at localnetsolutions.com
Wed Nov 17 17:51:35 EST 2004


On Wed, 2004-11-17 at 13:33, Fletch wrote:

> $ perl -le 'print "a" x 2047, "\xff" x 16, "b" x 512' > foo
> $ perl -lne 'BEGIN{$/=\1024}$o=($.-1)*1024-length$b;$b.=$_;print "hit byte ", $o + $-[0] if $b =~ /\xff{16}/;$b=substr($b,-15,15)' foo
> hit byte 2047
> $ perl -le 'print "a" x 2040, "\xff" x 16, "b" x 512' > foo
> $ perl -lne 'BEGIN{$/=\1024}$o=($.-1)*1024-length$b;$b.=$_;print "hit byte ", $o + $-[0] if $b =~ /\xff{16}/;$b=substr($b,-15,15)' foo
> hit byte 2040

There are days I truly hate perl....

I'm hoping that Perl 7 will include the Psionics module and just read my
mind...
-- 
James P. Kinney III          \Changing the mobile computing world/
CEO & Director of Engineering \          one Linux user         /
Local Net Solutions,LLC        \           at a time.          /
770-493-8244                    \.___________________________./
http://www.localnetsolutions.com

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part




More information about the Ale mailing list