title: CSV Filtering a column with mixed data types
body: <p>I have a CSV with many columns and rows.  Column 4 has some strings and some not.  When I attempt to filter out duplicates it removes ones I want to keep.  </p>
  
  <p>When I run: </p>
  
  <pre><code>awk -F ',' '!seen[$4]++' oldfile.csv &gt; newfile.csv
  </code></pre>
  
  <p>on </p>
  
  <pre><code>71523180,PRASAD  JAMES ANAND, ,#3 ALEX BOYD LINK HILLSBORO
  71523190,PRASAD  SHAKUNPALA, ,#3 ALEX BOYD LINK HILLSBORO
  71523200,PRASAD  BOBBY UMENDRA, ,#3 ALEX BOYD LINK HILLSBORO
  </code></pre>
  
  <p>it returns what I want:</p>
  
  <pre><code>71523180,PRASAD  JAMES ANAND, ,#3 ALEX BOYD LINK HILLSBORO
  </code></pre>
  
  <p>But, when I run that line of code on</p>
  
  <pre><code>71508050,"HUNT,  RICHARD F", ,1009 # B FATHOM DR
  71508060,"HUNT,  RICHARD F", ,1009 # B FATHOM DR
  71561950,"HUNT,  RICHARD F", ,1009 # B FATHOM DR
  71562840,"HUNT,  RICHARD F", ,1009 # B FATHOM DR
  </code></pre>
  
  <p>it deletes all those entries.</p>
  
  <p>What to do? Thanks</p>
  
  <hr>
  
  <p><strong>FOLLOW UP</strong></p>
  
  <p>Using perl seems to work, but gives me a small error.  Is this an issue?</p>
  
  <pre>$ perl -w -MText::CSV_XS=csv -e &apos;csv(in =&gt; \*STDIN, filter =&gt; { 4 =&gt; sub { ! $seen{$_}++ }})&apos; &lt; combined4.csv &gt; combined6.csv
  Name &quot;main::seen&quot; used only once: possible typo at -e line 1.</pre>