title: Do a tail -F until matching a pattern
body: <p>I want to do a <code>tail -F</code> on a file until matching a pattern. I found a way using <code>awk</code>, but IMHO my command is not really clean. The problem is that I <strong>need</strong> to do it in only one line, because of some limitations.</p>
  <pre><code>tail -n +0 -F /tmp/foo | \
  awk -W interactive '{if ($1 == &quot;EOF&quot;) exit; print} END {system(&quot;echo EOF &gt;&gt; /tmp/foo&quot;)}'
  </code></pre>
  <p>The tail will block until <code>EOF</code> appears in the file. It works pretty well. The END block is mandatory because awk's <code>exit</code> does not exit right away. It makes <code>awk</code> to <code>eval</code> the END block before quitting. The END block hangs on a read call (because of tail), so the last thing I need to do, is to write another line in the file to force tail to exit.</p>
  <p>Does someone know a better way to do that?</p>