title: Tool for locating hex sequence in binary file
body: <p>Is there a Linux tool out there that locates a bit sequence given in hexadecimal representation in a binary file no matter how those bits are aligned in the file?</p>
  
  <p>Example: I want to locate the two byte long sequence <code>f2 40</code> in a binary file. The perfectly aligned representation <code>f2 40</code> can easily be found using <code>hd</code> and <code>grep</code>. But I also want to find <code>01 e4 80</code>, <code>d3 e4 81</code> or <code>ff e4 80</code> (which all include <code>f2 40</code> shifted by one bit to the left).</p>