title: bash: cat the first lines of a file & get position
body: <p>I got a very big file that contains n lines of text (with n being &lt;1000) at the beginning, an empty line and then lots of untyped binary data.</p>
  
  <p>I would like to extract the first n lines of text, and then somehow extract the exact offset of the binary data.</p>
  
  <p>Extracting the first lines is simple, but how can I get the offset? bash is not encoding aware, so just counting up the number of characters is senseless.</p>