title: Exclude from file one the lines in common with file two and preserve line order
body: <p><strong>one</strong></p>
  <pre><code>pl
  a
  ff
  c
  b
  nn
  </code></pre>
  <p><strong>two</strong></p>
  <pre><code>b
  a
  z
  k
  c
  d
  </code></pre>
  <p>I want to remove from the first file all lines that are also in the second (common lines). And I want to maintain the file_one lines order.</p>
  <p>It's possible to work in a line by line check mode, something like:</p>
  <pre><code>while read line; do
    if ! grep $line two; then
      echo $line &gt;&gt; one_only
    fi
  done &lt; one
  </code></pre>
  <p>But it likely isn't the best option for a fast check.
  An other way would be using &quot;comm&quot; command on the files previously sorted:</p>
  <pre><code>comm -1 -2 &lt;(sort one) &lt;(sort two) \
    | tr '\n' '\|' \
    | sed 's/|/\\|/g;s/\\|$/\n/' \
    &gt; common_lines
  
  grep -v &quot;$(cat common_lines)&quot; one
  </code></pre>
  <p>first command creates a &quot;logical OR pattern&quot;:</p>
  <pre><code>a\|b\|c
  </code></pre>
  <p>which can be reuse with grep to exclude common lines from the &quot;one&quot; file. In this way the original order of &quot;one&quot; lines is preserved. And the result will be:</p>
  <pre><code>pl
  ff
  nn
  </code></pre>
  <p>Can you suggest any other idea to minimize compute time even more?</p>
  <p>Real input files are much more populated and contain short names (software names):</p>
  <pre><code>blender
  gimp
  vim
  emacs
  mozilla-firefox
  google-earth
  </code></pre>
  <p>and so on...</p>