com.mindprod.csv
Class CSVDeDup

java.lang.Object
  extended by com.mindprod.csv.CSVDeDup

public final class CSVDeDup
extends java.lang.Object

DeDup CSV File: remove duplicate records.

Use: java.exe com.mindprod.CSVDeDup somefile.csv 2 3 may specify 0-based columns of column to exclude when determining dups. These columns are allowed to be different, and if the other columns match, subsequent matching records are discarded. Comments are ignored when determining duplicates.

Since:
2010
Version:
1.1 2011-01-25 allow you to specify encoding
Author:
Roedy Green, Canadian Mind Products

Constructor Summary
CSVDeDup(java.io.File file, char separatorChar, char quoteChar, char commentChar, java.lang.String encoding, int... exceptionCols)
          DeDup a CSV file, constructor.
 
Method Summary
static void main(java.lang.String[] args)
          Simple command line interface to CSVDeDup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVDeDup

public CSVDeDup(java.io.File file,
                char separatorChar,
                char quoteChar,
                char commentChar,
                java.lang.String encoding,
                int... exceptionCols)
         throws java.io.IOException
DeDup a CSV file, constructor. Just create. There are no methods to call.

Parameters:
file - CSV file to be packed to remove excess space and quotes.
separatorChar - field separator character, usually ',' in North America, ';' in Europe and sometimes '\t' for tab.
quoteChar - char to use to enclose fields containing a separator, usually '\"'. Use (char)0 if you don't want a quote character.
commentChar - char to use to introduce comments. Use (char) 0 if none. Only one character allowed.
encoding - encoding of input and output file.
exceptionCols - columns that are allowed to be different, and still count as a duplicate.
Throws:
java.io.IOException - if problems reading/writing file
Method Detail

main

public static void main(java.lang.String[] args)
Simple command line interface to CSVDeDup. Dedups one csv file whose name is on the command line. Must have extension .csv
Use java com.mindprod.CSVDeDup somefile.csv 2 3

Parameters:
args - name of csv file to remove excess quotes and space