title: Compare lines in 2 text files
body: <p>I have two large text files (200,000+ lines), CSV format. I need to compare them, line by line, but the fields maybe switched within each line.</p>
  
  <p>Example file <code>A.csv</code>:</p>
  
  <pre><code>AAA,BBB,,DDD  
  EEE,,GGG,HHH  
  III,JJJ,KKK,LLL
  </code></pre>
  
  <p>Example file <code>B.csv</code>:</p>
  
  <pre><code>AAA,,BBB,DDD  
  EEE,,GGG,HHH  
  LLL,KKK,JJJ,III
  </code></pre>
  
  <p>So for my purposes, <code>A.csv</code> and <code>B.csv</code> should be "identical" even though fields are switch in the first and last line. Since the fields in each file might be in a different order, the usual options like grep or diff won't work.</p>
  
  <p>Basically, I think I need to write something that reads a line of <code>A.csv</code> and <code>B.csv</code>, and checks if all fields are present in both lines, independent of the order. Alternatively, something that orders the fields after reading the lines.</p>