title: Delete first line of file if it's empty
body: <p>How can I delete the first (!) line of a text file if it's empty, using e.g. sed or other standard UNIX tools. I tried this command:</p>
  
  <pre><code>sed '/^$/d' &lt; somefile
  </code></pre>
  
  <p>But this will delete the first empty line, not the first line of the file, if it's empty. Can I give sed some condition, concerning the line number?</p>
  
  <p>With Levon's answer I built this small script based on awk:</p>
  
  <pre><code>#!/bin/bash
  
  for FILE in $(find some_directory -name "*.csv")
  do
      echo Processing ${FILE}
  
      awk '{if (NR==1 &amp;&amp; NF==0) next};1' &lt; ${FILE} &gt; ${FILE}.killfirstline
      mv ${FILE}.killfirstline ${FILE}
  
  done
  </code></pre>