title: Merging several text files line by line in python
body: <p>I'm a network engineer by trade, new to python, and this question will be applied to access lists on routers but for simplicity I am going to use States and Cities. </p>
  
  <p>I have several text files (two below) that contains lines of States and Cities as shown:</p>
  
  <p>File1</p>
  
  <pre><code>Texas
  Austin
  Dallas
  Houston
  San Antonio
  </code></pre>
  
  <p>File2</p>
  
  <pre><code>Texas
  Amarillo
  Austin
  Dallas
  San Antonio
  Waco
  </code></pre>
  
  <p>I need to merge these two files and spit out a new text file that looks like the one below:</p>
  
  <pre><code>Texas
  Amarillo
  Austin
  Dallas
  Houston
  San Antonio
  Waco
  </code></pre>
  
  <p>The positioning has to be precise in such a way that since file1 is missing Amarillo compared to file2, and file2 has Amarillo on top of Austin, then merged file will have Amarillo on top of Austin or below Texas in the resulting file. The same thing applies if it was the other way around where file2 is missing some cities compared to file1. </p>
  
  <p>I'm not too sure how to start this script. A guiding hand would be appreciated!</p>
  
  <p>thanks!</p>