[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-date: Wed Nov 17 18:01:01 2004 -->
- <!--x-from-r13: wbr ng znqrjryy.pbz (Xbr Egrryr) -->
- <!--x-message-id: [email protected] -->
- <!--x-subject: [ale] Binary Grep -->
- <li><em>date</em>: Wed Nov 17 18:01:01 2004</li>
- <li><em>from</em>: joe at madewell.com (Joe Steele)</li>
- <li><em>subject</em>: [ale] Binary Grep</li>
Well, since I've already been labeled a spoil sport... :)
What about:
$ perl -le 'print "a" x 400, "\xff" x 16, "a" x 400, "\xff" x 16, "a" x 400, "\xff" x 16' > 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 400
hit byte 1232
^^^^^^^^^ No hit byte at 816 :(
Trying again:
$ perl -le 'print "a" x 400, "\xff" x 16, "a" x 400, "\xff" x 16, "a" x 400, "\xff" x 16' > foo
$ perl -lne 'BEGIN{$/=\31}$o=($.-1)*31-length$b;$b.=$_;print"hit byte ",$o+$-[0]if$b=~/\xff{16}/;$b=substr($b,-15,15)' foo
hit byte 400
hit byte 816
hit byte 1232
Notice also that I have cut down on the gratuitous use of needless
white space without any loss of readability :)
--Joe
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00767" href="msg00767.html">[ale] Binary Grep</a></strong>
<ul><li><em>From:</em> fletch at phydeaux.org (Fletch)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00765.html">[ale] Binary Grep</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00767.html">[ale] Binary Grep</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00765.html">[ale] Binary Grep</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00767.html">[ale] Binary Grep</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00766"><strong>Date</strong></a></li>
<li><a href="threads.html#00766"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>