import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class test1 {
public static void main(String[] args) throws IOException {
try {
//读取数据
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\xugui\\Desktop\\my_bvlc_alexnet_HZ.log.txt"));
//写入数据
PrintWriter out = new PrintWriter(new BufferedWriter(
new FileWriter("C:\\Users\\xugui\\Desktop\\1.txt", true)));
//line用来存放一行的字符串
String line = null;
int n=1;
//按行读取
while ((line = br.readLine()) != null) {
if(n==1){
n++;
continue;
}
System.out.println(line);
//分割字符串
String str[]=line.split(",");
//按行写入
out.println(str[0]+" "+str[3]);
}
if (br != null) {
//关闭输入流
br.close();
}
if (out != null) {
//关闭输出流
out.close();
}
}
//捕获异常
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//完成标志
System.out.println("over");
}
}
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class test1 {
public static void main(String[] args) throws IOException {
try {
//读取数据
BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\xugui\\Desktop\\my_bvlc_alexnet_HZ.log.txt"));
//写入数据
PrintWriter out = new PrintWriter(new BufferedWriter(
new FileWriter("C:\\Users\\xugui\\Desktop\\1.txt", true)));
//line用来存放一行的字符串
String line = null;
int n=1;
//按行读取
while ((line = br.readLine()) != null) {
if(n==1){
n++;
continue;
}
System.out.println(line);
//分割字符串
String str[]=line.split(",");
//按行写入
out.println(str[0]+" "+str[3]);
}
if (br != null) {
//关闭输入流
br.close();
}
if (out != null) {
//关闭输出流
out.close();
}
}
//捕获异常
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//完成标志
System.out.println("over");
}
}