title: sort across multiple files in linux
body: <p>I have multiple (many) files; each very large:</p>
  
  <pre><code>file0.txt
  file1.txt
  file2.txt
  </code></pre>
  
  <p>I do not want to join them into a single file because the resulting file would be 10+ Gigs.  Each line in each file contains a 40-byte string.  The strings are fairly well ordered right now, (about 1:10 steps is a decrease in value instead of an increase).</p>
  
  <p>I would like the lines ordered. (in-place if possible?)  This means some of the lines from the end of <code>file0.txt</code> will be moved to the beginning of <code>file1.txt</code> and vice versa. </p>
  
  <p>I am working on Linux and fairly new to it.  I know about the <code>sort</code> command for a single file, but am wondering if there is a way to sort across multiple files.  Or maybe there is a way to make a pseudo-file made from smaller files that linux will treat as a single file.</p>
  
  <p>What I know can do:
  I can sort each file individually and read into <code>file1.txt</code> to find the value larger than the largest in <code>file0.txt</code> (and similarly grab the lines from the end of <code>file0.txt</code>), join and then sort..  but this is a pain and assumes no values from <code>file2.txt</code> belong in <code>file0.txt</code> (however highly unlikely in my case)</p>
  
  <h2>Edit</h2>
  
  <p>To be clear, if the files look like this:</p>
  
  <pre><code>f0.txt
  DDD
  XXX
  AAA
  
  f1.txt
  BBB
  FFF
  CCC
  
  f2.txt
  EEE
  YYY
  ZZZ
  </code></pre>
  
  <p>I want this:</p>
  
  <pre><code>f0.txt
  AAA
  BBB
  CCC
  
  f1.txt
  DDD
  EEE
  FFF
  
  f2.txt
  XXX
  YYY
  ZZZ
  </code></pre>