本帖最后由 pcl_test 于 2016-10-28 22:00 编辑
| | | | | var fso=new ActiveXObject('Scripting.FileSystemObject'),b=[],n=0; | | var b=fso.OpenTextFile('b.txt',1).ReadAll().split(/[\r\n]+/); | | var a=fso.OpenTextFile('a.txt',1).ReadAll(); | | var a=a.replace(/\b(TITLE\s*?)".*"/g,function($0,$1){ | | n++; | | return b[n-1]?$1+'"'+b[n-1]+'"':$0; | | }) | | WSH.echo(a);COPY |
| | | powershell -c "$n=0;$b=gc 'b.txt';gc 'a.txt'|%%{if($_ -match '^\s*?TITLE\s*?\".*\"'){if($b[$n]){$_ -replace '\".*\"\s*$',$b[$n];}else{$_};$n++;}else{$_}}" | | pauseCOPY |
| rem 第三方http://www.bathome.net/s/tool/index.html?down&key=gawk | | gawk "NR==FNR{b[NR]=$0;next}/^\s*TITLE\s*\".*\"/{t++;if(b[t])sub(/\".*\"/,\"\x22\"b[t]\"\x22\")}1" "b.txt" "a.txt" | | pauseCOPY |
|