title: Save output of cat, pipe, while loop to file
body: <p>I want to search in some text for words from list saved as file: <code>merged.failed</code>. Then I want to redirect the output of this command to file</p>
  <pre><code>cat merged.failed | while read f; do grep -io $f /home/some/path/some.txt; done | sort &gt; merged.failed
  </code></pre>
  <p>When I do so the merged.failed file becomes empty. However, wihotut <code>&gt; merged.failed</code> the correct output prints</p>