title: How to write integer to binary file using Bash?
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="https://stackoverflow.com/questions/2746707/using-bash-write-bit-representation-of-integer-to-file">using bash: write bit representation of integer to file</a></p>
  </blockquote>
  
  <p>I need to write the size of a file into a binary file. For example:</p>
  <pre><code>$ stat -c %s in.txt 
  68187
  
  $ stat -c %s in.txt &gt;&gt; out.bin
  </code></pre>
  <p>Instead of writing 68187 as a string to out.bin, i want to write it as a 4 bytes integer to out.bin.</p>