Batch script to create large text file -


i'm trying create text file around 4 gig. have done using batch script creation took around 7 hours , think there must better way it. here's code using right now:

echo "toa5","cr6series","cr6","790","cr6.std.02.11","cpu:datatypes.cr6","26536","onesec" > complete2.txt echo "timestamp","record","unicodesmpl","fp2smpl","ieee4smpl","uint2smpl","longsmpl","stringsmpl","booleansmpl","bool8smpl_1(1)","bool8smpl_1(2)","bool8smpl_1(3)","bool8smpl_1(4)","bool8smpl_1(5)","bool8smpl_1(6)","bool8smpl_1(7)","bool8smpl_1(8)","bool8smpl_2(1)","bool8smpl_2(2)","bool8smpl_2(3)","bool8smpl_2(4)","bool8smpl_2(5)","bool8smpl_2(6)","bool8smpl_2(7)","bool8smpl_2(8)","nsecsmpl" >> complete2.txt echo "ts","rn","","","","","","","","","","","","","","","","","","","","","","","","" >> complete2.txt echo "","","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp" >> complete2.txt /l %%i in (0,1,23616999) echo "2015-05-13 12:11:53",%%i,"大 不束 ロガー 233",-6388,-2.395906e+034,52338,-1715056512,"test string",0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,"2015-05-13 12:11:53.078" >> complete2.txt 

the first 4 lines needed header file. loop used increment "record" number in file , fill file enough data make 4 gigs. other requirement file have each "record" on new line.

like said, current code need do, i'm looking way speed significantly.

rather open, append, close, open, append, close, open, append, close, etc. 23616999 iterations, it'll improve efficiency if open file 1 time, perform entire loop sequence file open, close after finished. change syntax thusly:

rem; @cls @echo off setlocal  /f "tokens=4" %%i in ('chcp') set "chcp=%%i" chcp 65001 >nul  >complete2.txt (     echo "toa5","cr6series","cr6","790","cr6.std.02.11","cpu:datatypes.cr6","26536","onesec"     echo "timestamp","record","unicodesmpl","fp2smpl","ieee4smpl","uint2smpl","longsmpl","stringsmpl","booleansmpl","bool8smpl_1(1)","bool8smpl_1(2)","bool8smpl_1(3)","bool8smpl_1(4)","bool8smpl_1(5)","bool8smpl_1(6)","bool8smpl_1(7)","bool8smpl_1(8)","bool8smpl_2(1)","bool8smpl_2(2)","bool8smpl_2(3)","bool8smpl_2(4)","bool8smpl_2(5)","bool8smpl_2(6)","bool8smpl_2(7)","bool8smpl_2(8)","nsecsmpl"     echo "ts","rn","","","","","","","","","","","","","","","","","","","","","","","",""     echo "","","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp","smp"     /l %%i in (0,1,23616999) echo "2015-05-13 12:11:53",%%i,"大 不束 ロガー 233",-6388,-2.395906e+034,52338,-1715056512,"test string",0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,"2015-05-13 12:11:53.078" )  chcp %chcp% >nul 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -