#!/bin/awk -f /^File /{flag=1;name=$2;} /^Directory /{flag=2;name=$2;} /^End/{flag=0;name="";} (flag==1)&&/[ \t]Name[ \t]/{ gsub(/[\"; \t]/,""); split($0,TAB,"="); gsub(/Name/,"",TAB[1]); if (TAB[1]=="")TAB[1]="01"; gsub(/[\(\)]/,"",TAB[1]); files_name[TAB[1],name]=TAB[2]; }; (flag==1)&&/[ \t]PackedName[ \t]/{ gsub(/[\"; \t]/,""); split($0,TAB,"="); gsub(/PackedName/,"",TAB[1]); if (TAB[1]=="")TAB[1]="01"; gsub(/[\(\)]/,"",TAB[1]); files_packedname[TAB[1],name]=TAB[2]; }; (flag==1)&&/[ \t]Dir[ \t]/{ gsub(/[\"; \t]/,""); split($0,TAB,"="); gsub(/Dir/,"",TAB[1]); if (TAB[1]=="")TAB[1]="01"; gsub(/[\(\)]/,"",TAB[1]); files_dir[TAB[1],name]=TAB[2]; }; (flag==2)&&/[ \t]ParentID[ \t]/{ gsub(/[\"; \t]/,""); split($0,TAB,"="); dirs_parent[name]=TAB[2]; } (flag==2)&&/[ \t]HostName[ \t]/{ gsub(/[\"; \t]/,""); split($0,TAB,"="); dirs_hostname[name]=TAB[2]; } END{ #exit; for (arg in ARGV){ split(ARGV[arg],TAB,"="); param[TAB[1]]=TAB[2]; } for (f in files_packedname){ f2=f; gsub(/[0-9][0-9]/,"",f2); lang=substr(f,1,2); dir=files_dir["01"f2]; # print lang; # print files_name[f]; # print files_packedname[f]; # print files_dir["01"f2]; path=""; # p1=dirs_parent[lang,dir]; p1=dir; while (p1!=""){ p2=p1; path=dirs_hostname[p1] "/" path; p1=dirs_parent[p1] } if (p2=="PREDEFINED_PROGDIR"){ path=param["DIRTO"] path; file=param["DIRFROM"] lang "/normal/" files_packedname[f]; cmd="unzip -d "path" -o "file; system("mkdir -p "path); system(cmd); # print cmd; # print p2,path; } else if (p2=="PREDEFINED_HOMEDIR"){ } else if (p2=="PREDEFINED_NS6PLUGINDIR"){ } else if (p2=="PREDEFINED_NSPLUGINDIR"){ } # exit; # print path,dir; # print dirs_parent[lang,dir]; # print "==="; } }