package regionForKeywords;

import java.io.*;

/**
* Created by huangjiahong on 2016/2/25.
*/
public class RegionKeywordExcelTransform { public static void main(String[] args) { String inputFileName="D:\\USER\\huangjiahong\\Desktop\\region.txt";
String outputFileName="D:\\USER\\huangjiahong\\Desktop\\regionKeywords.txt";
File file = new File(inputFileName);
String line=null;
int errline=0;
int regionN=0; try {
BufferedReader reader =new BufferedReader(new FileReader(file));
File outFile = new File(outputFileName);
FileWriter write = new FileWriter(outputFileName, false); if(!outFile.exists()){
outFile.createNewFile();
}
while (null != (line = reader.readLine())){
try {
String[] lineSplit=line.split("\t");
String regionName=lineSplit[0];
regionN++;
String keywords[]=lineSplit[1].split("\\|");
//专区名也索引进去
// if(regionN==1||regionN==15) {
write.write(regionName + "\t" + regionN + "\t" + regionName + "\n"); for (String kw : keywords) {
write.write(kw + "\t" + regionN + "\t" + regionName + "\n");
}
// }
}catch (ArrayIndexOutOfBoundsException a){
System.out.println((errline++)+":"+line);
a.printStackTrace();
} }
reader.close();
write.close(); } catch (IOException e) {
e.printStackTrace(); }
System.out.println("finished");
}
}

最新文章

  1. 反射实现 AOP 动态代理模式(Spring AOP 的实现 原理)
  2. js模仿新浪微博限制字数输入
  3. VM配置一个待安装LUNIX系统的环境
  4. linux 系统下开机自动启动oracle 监听和实例 (亲测有效)
  5. hibernate将本地SQL查询结果封装成对象
  6. Linux复制指定目录下的文件夹结构
  7. 《Spark大数据处理:技术、应用与性能优化 》
  8. [LeetCode#204]Factorial Trailing Zeroes
  9. UVA 10129-Play on Words(欧拉通路)
  10. Android Activity 启动模式详解
  11. Android应用开发学习笔记之绘图
  12. Nginx运行Laravel的配置
  13. 2015十大顶级开源ERP系统点评
  14. 【Ubuntu 16】安装deb
  15. html select 标签设置默认选中
  16. Window环境下搭建Git服务器
  17. 学会学习:高效学习方式(使用vscode-snippet有感)
  18. Django之Form、ModelForm 组件
  19. MySQL.ERROR 1133 (42000): Can't find any matching row in the user table
  20. ylz简单增删改查实现

热门文章

  1. Android模板制作
  2. 在colab上运行style-transfer
  3. sql通过 openrowset查询csv文件
  4. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'needDao' defined in URL
  5. 解决python pip安装提示"not a supported wheel on this platform"
  6. SAP成都研究院安德鲁:自己动手开发一个Chrome Extension
  7. (转)使用Spring配置文件实现事务管理
  8. (转)编码剖析Spring依赖注入的原理
  9. VINS-Fusion代码阅读(四)
  10. tree 树状构建