User:TimBentley/dabsearch
From Wikipedia, the free encyclopedia
import java.io.*;
public class Dabsearch {
public static void main(String[] args) throws Exception { BufferedReader dablist = new BufferedReader(new InputStreamReader(new FileInputStream("disambiguation.txt"))); BufferedReader watchlist = new BufferedReader(new InputStreamReader(new FileInputStream("watchlist.txt"))); BufferedWriter output = new BufferedWriter(new FileWriter("output.txt")); String watch, dab; watch = watchlist.readLine(); while (watch != null) { dab = dablist.readLine(); while (dab != null) { if (dab.equals(watch)) { output.write(dab); break; } dab = dablist.readLine(); } dablist.close(); dablist = new BufferedReader(new InputStreamReader(new FileInputStream("disambiguation.txt"))); watch = watchlist.readLine(); } dablist.close(); watchlist.close(); output.close(); }
}