[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
回复 1# zhengwei007

第3方工具gawk( http://bcn.bathome.net/tool/4.1.0/gawk.exe )的实现方式如下:
  1. gawk -v"FS=\042" "BEGIN{print \"ingredientID\tcount\tingredientID\tcount\tingredientID\tcount\tingredientID\tcount\tingredientID\tcount\tproductionID\tcount\"}/^[\t ]*<item>$/,/^[\t ]*<\/item>$/{if(/^[\t ]*<ingredient count=.+id=.+>$/){A[++i]=$4;B[i]=$2}if(/^[\t ]*<production count=.+id=.+>$/){A[6]=$4;B[6]=$2;C=A[1]\"\t\"B[1];for(i=2;i<7;i++)C=C\"\t\"A[i]\"\t\"B[i];print C;delete A;delete B;i=0}}" *.xml>sour.csv
复制代码

TOP

返回列表