//
// SortList.java
//

import java.io.*;
import java.util.Arrays;
import java.util.Vector;

/** Sorts a text file alphabetically, removing duplicates. */
public class SortList {

  public static void main(String[] args) throws Exception {
    String file = args[0];
    Vector v = new Vector();
    BufferedReader fin = new BufferedReader(new FileReader(file));
    while (true) {
      String line = fin.readLine();
      if (line == null) break;
      v.add(line);
    }
    fin.close();
    String[] lines = new String[v.size()];
    v.copyInto(lines);
    Arrays.sort(lines);
    new File(file).renameTo(new File(file + ".old"));
    PrintWriter fout = new PrintWriter(new FileWriter(file));
    for (int i=0; i<lines.length; i++) {
      if (i == 0 || !lines[i].equals(lines[i-1])) fout.println(lines[i]);
    }
    fout.close();
  }

}

@@ -233,16 +233,61 @@
 ption %7B%0A
+    boolean showDups = args%5B0%5D.equals(%22-v%22);%0A
     Stri
@@ -301,16 +301,31 @@
  = args%5B
+showDups ? 1 : 
 0%5D;%0A    
@@ -865,16 +865,92 @@
 es%5Bi%5D);%0A
+      else if (showDups) System.out.println(%22Duplicate line: %22 + lines%5Bi%5D);%0A
     %7D%0A  

Add command line option to print a warning for each duplicate.