6759,20120709 06:23:00,1580.2,1580.9,1580.0,1580.5
6760,20120709 06:24:00,1580.5,1580.5,1580.3,1580.3
6761,20120709 06:25:00,1580.5,1580.5,1580.3,1580.3
6762,20120709 06:26:00,1580.3,1580.3,1580.3,1580.3
6763,20120709 06:27:00,1580.3,1580.3,1580.3,1580.3
6764,20120709 06:28:00,1580.3,1580.3,1580.3,1580.3
6765,20120709 06:29:00,1580.3,1580.5,1580.3,1580.3
6766,20120709 06:30:00,1580.6,1580.9,1580.6,1580.6 例如第二列的值:20120709 06:23:00 我想把它改成 201207090602300
------最佳解决方案--------------------
逐行读取,然后截取出日期信息,格式化后全部输出到另一个新文件。
最后把老文件删除,新文件重命名。
------其他解决方案--------------------
用UltraEdit打开文档,“搜索”菜单中有个“替换”
勾上下面的“正则表达式(E):Perl”
“查找什么”填上:([0-9]+,)([0-9]{8})\s+([0-9][0-9]):([0-9][0-9]):([0-9][0-9])(.*)
“替换为”填上\1\2\3\4\5\6
点击“全部替换”
------其他解决方案--------------------
我的代码是这样的:BufferedReader bufferedReader = null;
PrintWriter printWriter = null;
try{
bufferedReader = new BufferedReader(new FileReader("D:\\20120709.txt"));
String l;
while ((l = bufferedReader.readLine()) != null) {
// opeartion l System.out.println(l);
StringTokenizer star = new StringTokenizer(l ,"," );
int id = Integer.parseInt(star.nextToken().trim());
String time =star.nextToken();
//System.out.print(time);
String start = star.nextToken();
String high = star.nextToken();
String low = star.nextToken();
String end = star.nextToken();
if(time.equals("20120709 08:00:00")){
String buy=low.toString();
System.out.print("买进一笔");
}
else if(("这里面的话 我需要取大于("20120709 08:00:00"),以后的时间段.我不知道该在代码的那里吧time改下.求高手编码指导)