我有以下批处理文件,(这是一个例子,如果大约20mb的真正的那个) -
代码:
ECHO Assigning Aircraft Registrations to HEX/MODES codes.
ECHO This may take some time....
pause
copy input.csv backup1.csv
pause
call :FindReplace "342086" "EC-ISY" input.csv
call :FindReplace "0006AB" "I-AMCH" input.csv
call :FindReplace "00412D" "Z-WPF" input.csv
call :FindReplace "00415C" "Z-WPE" input.csv
call :FindReplace "00600A" "C9-AUL" input.csv
等
它永远服用,它从早上8点开始运行........它现在接近下午4点。 任何人都可以建议更快的处理方式吗?
答案 0 :(得分:1)
您只需使用相应的工具,例如JScript语言:
@if (@CodeSection == @Batch) @then
@echo off
ECHO Assigning Aircraft Registrations to HEX/MODES codes.
ECHO This may take some time....
copy input.csv backup1.csv
cscript //nologo //E:JScript "%~F0" < input.csv > output.csv
move /Y output.csv input.csv
goto :EOF
@end
// Very simple method to replace *several* different strings in just a single file pass
var fileContents = WScript.StdIn.ReadAll(), repl = new Array();
repl["342086"] = "EC-ISY";
repl["0006AB"] = "I-AMCH";
repl["00412D"] = "Z-WPF";
repl["00415C"] = "Z-WPE";
repl["00600A"] = "C9-AUL";
WScript.Stdout.Write(fileContents.replace(/342086|0006AB|00412D|00415C|00600A/g,
function (A){return repl[A]}));
答案 1 :(得分:0)
SED
,AWK
和GAWK
会更快 - 有免费赠品版本。