本帖最后由 pcl_test 于 2016-9-3 07:14 编辑
第三方http://www.bathome.net/s/tool/index.html?key=gawk- #*&cls&gawk -f "%~f0" "box文件.txt">con&pause&exit
- BEGIN{split(" ,#, ,.,$,*,@,+",reg,",")}
- {
- gsub(/^[[:space:]]*|[[:space:]]*$/,"",$0);
- if($0~/^\[Level [0-9]+\]/)level=substr($0,2,length($0)-2);
- if($0~/^MapWidth=[1-9][0-9]*/)split($0,width,"=");
- if($0~/^MapData=[0-7]+/)split($0,data,"=");
- if(width[2]&&data[2]){
- n=1;
- while((str=substr(data[2],n,width[2]))!=""){
- s="";
- for(i=1;i<=length(str);i++){
- s=s""reg[substr(str,i,1)+1];
- }
- n+=width[2];
- print s,str;
- }
- print "; "level"\n"
- delete width;
- delete data;
- }
- }
复制代码
- #*&cls&gawk -f "%~f0" "box文件.txt">con&pause&exit
- BEGIN{split(" ,#, ,.,$,*,@,+",reg,",")}
- {
- gsub(/^[[:space:]]*|[[:space:]]*$/,"",$0);
- if($0~/^\[Level [0-9]+\]/)level=substr($0,2,length($0)-2);
- if($0~/^MapWidth=[1-9][0-9]*/)split($0,width,"=");
- if($0~/^MapData=[0-7]+/)split($0,data,"=");
- if(width[2]&&data[2]){
- for(i=0;i<=7;i++)gsub(i,reg[i+1],data[2]);
- n=1;
- while((str=substr(data[2],n,width[2]))!=""){
- n+=width[2];
- print str;
- }
- print "; "level"\n"
- delete width;
- delete data;
- }
- }
复制代码
|