Skip to content

Instantly share code, notes, and snippets.

@alisaifee
Created June 23, 2012 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alisaifee/2977681 to your computer and use it in GitHub Desktop.
Save alisaifee/2977681 to your computer and use it in GitHub Desktop.
import java.util.*;
import java.io.*;
class Reduce
{
public static void main( String [] args){
try{
String ref = args[0];
String data = args[1];
FileInputStream fref = new FileInputStream(ref);
FileInputStream fdata = new FileInputStream(data);
Set<String> refs = new HashSet<String>();
DataInputStream in = new DataInputStream(fref);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ( ( line = br.readLine () ) != null ){
refs.add( line );
}
in = new DataInputStream(fdata);
br = new BufferedReader(new InputStreamReader(in));
while ( ( line = br.readLine () ) != null ){
String [] tokens = line.split(",");
if ( !refs.contains ( tokens [0] ) ){
System.out.println(line);
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment