import
java.io.BufferedReader;
import
java.io.BufferedWriter;
import
java.io.File;
import
java.io.FileNotFoundException;
import
java.io.FileReader;
import
java.io.FileWriter;
import
java.io.IOException;
public
class
file {
/**
*
@param
args
*
@throws
IOException
*/
public
static
void
read()
throws
IOException{
String fileName =
"Compound.txt"
;
File file=
new
File(fileName);
//打开文件和关闭文件一次
BufferedReader reader =
new
BufferedReader(
new
FileReader(file));
BufferedWriter writer =
new
BufferedWriter(
new
FileWriter(
new
File(
"rs.txt"
)));
String tempString =
null
;
try
{
tempString = reader.readLine();
}
catch
(IOException e1) {
//
TODO
Auto-generated catch block
e1.printStackTrace();
}
while
(tempString!=
null
&&tempString.length()>0){
//分割字符串
String str1=
null
;
String str2=
null
;
String[] subs = tempString.split(
"\t"
);
str1=subs[0];
str2=subs[1];
String str3=str2.substring(59);
System.
out
.println(str1+
"\t"
+str3);
//write
try
{
writer.write(str1+
"\t"
+str3);
writer.write(
"\n"
);
}
catch
(Exception e){
}
tempString = reader.readLine();
}
writer.close();
reader.close();
}