title: how to redirect output from sed command to a file
body: <p>I have a log that produce lots of text in the line along side the string that i want to get. basically it contains something like:</p>
  
  <pre><code>bla bla bla packet 12 out of 432 bla bla
  </code></pre>
  
  <p>I have this big command:</p>
  
  <pre><code>tail -f log.txt |grep --line-buffered "packet" |sed -n 's/.*\(packet [0-9]* out of [0-9]*\).*/\1/p' |while read log; do echo "$(date +%F_%H:%m:%S:%N) $log" ; done 
  </code></pre>
  
  <p>and I want to redirect the output to file.</p>
  
  <p>Why <code>&gt;&gt; file</code> does not work? What am I doing wrong?
  </p>