title: Remove line feed(s) from start of specific files
body: <p>I need to remove any occurrences of line feeds (carriage returns on a mac) from the very start of all files with the .php or .html extension. There are <em>no</em> other characters between the line feeds like spaces or anything.</p>
  
  <p>So for example (using /lf as an example of line feed):</p>
  
  <pre><code>/lf
  /lf
  &lt;!doctype html&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>/lf
  &lt;!doctype html&gt;
  </code></pre>
  
  <p>should be reduced down to:</p>
  
  <pre><code>&lt;!doctype html&gt;
  </code></pre>
  
  <p>One way of removing line feeds I've found is:</p>
  
  <pre><code>tr -d '\012'
  </code></pre>
  
  <p>But I have no idea how to target this at specific files, let alone only the first few lines.</p>
  
  <p>So I've got the following:</p>
  
  <pre><code>find . \( -name "*.php" -or -name "*.html" \) | xargs grep -l "\012" | xargs sed -i -e "s/\012//g"
  </code></pre>
  
  <p>But this won't target only the first few lines, and I'm not entirely sure if it correctly targets line feeds either.</p>
  
  <p>So, anyone got any bright ideas?</p>