title: List of unique headers recursively on files matching pattern
body: <p>I want the unique headers for a bunch of <code>csv</code> files whose names contain <code>ABC</code> or <code>XYZ</code>.</p>
  
  <p>Within a single directory, I can sort of get what I need with:</p>
  
  <pre class="lang-sh prettyprint-override"><code>head -n ` *.csv &gt; first.txt
  cat -A first.txt | tr ',' '\n' | sort | uniq
  </code></pre>
  
  <p>Of course, this isn't recursive and it includes <em>all</em> <code>csv</code> files, not just the ones I want.</p>
  
  <p>If I do the following, I get the recursive search, but also a bunch of junk:</p>
  
  <pre class="lang-sh prettyprint-override"><code>find . -type f -name "ABC*.csv" -o -name "XYZ*.csv" | xargs head -n 1 | tr ',' '\n' | sort | uniq
  </code></pre>
  
  <p>I'm on Windows 10 with MinGW64.  I suppose I could use Python, but I feel so close to having it!</p>