package goo2;
import tool.*;
import java.io.*;
import java.io.File;
public class pro {
int s,datanumber;
String[] data=new String[5000];
int number;
String[] namex=new String[500000];
String[] timex=new String[500000];
String[] sta=new String[500000];
String[] code=new String[500000];
String[] subcode=new String[500000];
String[] web=new String[500];
int number_goo;
String[] year=new String[500000];
String[] month=new String[500000];
String[] day=new String[500000];
public static void main(String[] args) {
pro r=new pro();
}
pro(){
File f=new File("data");
String[] ff=f.list();
int tr;
int tx=0;
for(tr=0;tr<ff.length;tr++){
String y1=ff[tr].substring(1,5);
String m1=ff[tr].substring(5,7);
String d1=ff[tr].substring(7,9);
readfile sub2=new readfile();
sub2.makedata("data/"+ff[tr],"UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
String str=x[2];
int p1=str.indexOf("/pro");
p1=str.indexOf("/",p1+1);
int p2=str.indexOf("/",p1+1);
int p3=str.indexOf("/",p2+1);
int p4=str.indexOf("/",p3+1);
if(str.indexOf("http")>-1){
tx=tx+1;
sta[tx]=str.substring(p1+1,p2);
code[tx]=str.substring(p2+1,p3);
subcode[tx]=str.substring(p3+1,p4);
year[tx]=y1;
month[tx]=m1;
day[tx]=d1;
timex[tx]=x[0];
namex[tx]=x[1].replace("\"","");
}
}
}
number=tx;
writexml("ren.txt");
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<number+1;s++){
pw.println(year[s]+","+month[s]+","+day[s]+","+timex[s]+","+namex[s]+","+sta[s]+","+code[s]+","+subcode[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
String clean_str(String str){
int kk;
String sp=str;
for(kk=1;kk<15;kk++){
sp=fresh(sp);
}
return sp;
}
String fresh(String strstr){
strstr=""+strstr;
int p1=strstr.indexOf("<");
int p2=-1;
if(p1>-1)p2=strstr.indexOf(">",p1);
String k="";
if(p2>-1)k=strstr.substring(p1,p2)+">";
String strxp=strstr.replace(k,"");
return strxp;
}
}
最終更新:2017年05月04日 04:29