import java.io.*;
public class author{
String[] data=new String[50000];
String[] author=new String[500];
int s,sx,datanumber,articlenumber;
String file;
String str,str1,str2;
int page,p1,p2;
public static void main(String[] args){
author test=new author();
}
author(){
for(page=1;page<220;page++){
file="gdata/";
file=file+page;
file=file+".txt";
readfile(file);
str1="(";
str2=")";
for(s=1;s<datanumber+1;s++){
p1=data[s].indexOf(str1);
p2=data[s].indexOf(str2);
str=data[s].substring(p1+1,p2);
author[s]=str;
}
file="author/";
file=file+page;
file=file+".txt";
writefile(file);
}
}
void writefile(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber+1;s++){
pw.println(author[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
void readfile(String file){
String str;
BufferedReader br;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2011年07月05日 00:10