package join;
import tool.*;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[600];
String[] sta=new String[70000];
String[][] memo=new String[70][100];
int[][] card=new int[70][10];
int[][] point=new int[70][10];
String[] t=new String[700];
String[] name=new String[70];
String[] xdate=new String[70000];
String[] date=new String[70];
String[] subdata=new String[70000];
public static void main(String[] args) {
pro re=new pro();
}
pro(){
readfile sub=new readfile();
sub.makedata("ren.txt","UTF-8");
t=sub.data;
name[1]="NHK";
name[2]="日本";
name[3]="TBS";
name[4]="フジ";
name[5]="朝日";
name[6]="東京";
int tr;
int tx=0;
for(tr=1;tr<337;tr++){
readfile sub2=new readfile();
sub2.makedata("tv/"+tr+".txt","UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
sta[s]=x[0];
date[s]="";
if(x.length>2)date[s]=x[1]+","+x[2];
}
int sx,h;
for(s=1;s<datanumber+1;s++){
xdate[s]="△,△";
for(sx=s+1;sx<datanumber+1;sx++){
h=0;
if(sta[s].equals(sta[sx]))h=h+1;
if(xdate[s].indexOf("△")>-1)h=h+1;
if(h==2)xdate[s]=date[sx];
}
}
for(s=1;s<datanumber+1;s++){
tx=tx+1;
subdata[tx]=t[tr]+","+data[s]+","+xdate[s];
subdata[tx]=subdata[tx].replace("<TITLE>","");
subdata[tx]=subdata[tx].replace("</TITLE>","");
}
}
datanumber=tx;
writexml("d.txt");
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber+1;s++){
String[] z=subdata[s].split(",");
if(z.length>4)pw.println(subdata[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2016年08月23日 17:47