本帖最后由 pcl_test 于 2015-9-6 00:21 编辑
样本不足,并不能考虑全部的情况,最好打包上传原件- @if(0)==(0) echo off&cscript -nologo -e:jscript "%~f0"<"test1.txt"&pause & exit/b@end
- var t1=t2='';
- var arr = WScript.StdIn.ReadAll().split(/\s*\r?\n/);
- arr.push('#');
- for (var i=0;i<arr.length;i++){
- if (def==0&&!/|\s+|+/.test(arr[i])){
- WSH.Echo(t1.replace(/\s+/g,'')+' '+t2.replace(/|[\s|]*$/,''));
- def=1;t1=t2='';
- }
- var str1 = arr[i].replace(/|.+$/g,'');
- var str2 = arr[i].replace(/^[^|]+/,'');
- t1 += str1;t2 += str2;var def=0;
- }
复制代码
|