title: Why can't sed replace 0x24 byte in binary file?
body: <p>I'm want to replace some bytes in binary file to another.
  Created sample (6 bytes long) file via</p>
  
  <pre><code>echo -ne '\x8f\x15\x42\x02\x24\xc2' &gt; test
  </code></pre>
  
  <p>Then tried to replace bytes <strong>\x15\x42\x02</strong> to <strong>\x12\x12\x02</strong> via sed: </p>
  
  <pre><code>sed 's \x15\x42\x02 \x12\x12\x02 g' test &gt; test1
  </code></pre>
  
  <p>sed replaced bytes: </p>
  
  <pre><code>cat test test1 | xxd -c 6
  0000000: 8f15 4202 24c2  ..B.$.
  0000006: 8f12 1202 24c2  ....$.
             ^^ ^^^^
  </code></pre>
  
  <p>Tried then replace bytes <strong>\x42\x02\x24</strong> to <strong>\x12\x02\x24</strong>: </p>
  
  <pre><code>sed 's \x42\x02\x24 \x12\x02\x24 g' test &gt; test2
  </code></pre>
  
  <p>sed NOT replaced bytes: </p>
  
  <pre><code>cat test test2 | xxd -c 6
  0000000: 8f15 4202 24c2  ..B.$.
  0000006: 8f15 4202 24c2  ..B.$.
                ^^^^ ^^
  </code></pre>
  
  <p>What's wrong? I have sed (GNU sed) 4.2.2 (Kubuntu 13.10)</p>
  
  <p>Thank You.</p>