Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find and Replace in huge text file
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01053411
Message ID:
01054175
Views:
35
You should also try using WSH (from within VFP) to do this. You will be amazed by its speed. It will beat the time set by VFP.

Regards,

Ron

>I forgot to mention it runs as fast as 68 find & Replace through 130 MB file in just 50 minutes, that is very good.
>
>>I did some modification to Cetin Greg code, here it is:-
>>
>>#DEFINE MAXBUFFER 65530
>>lhIn = FOPEN(lcFileIn)
>>lhOut = FCREATE(lcFileOut)
>>DO WHILE NOT FEOF(m.lhIn )
>> lcBuffer = FREAD(m.lhIn, MAXBUFFER)
>> lnfindlen = LEN(cFind)
>> FOR lncounter = lnfindlen TO 1 STEP -1
>> IF RIGHT(lcBuffer,lncounter) == SUBSTR(cFind, 1, lncounter)
>> FSEEK(m.lhIn, -(lncounter), 1)
>> lcBuffer = LEFT(lcBuffer,LEN(lcBuffer) - lncounter)
>> ENDIF
>> ENDFOR
>> lcBufferOut = STRTRAN(lcBuffer,cFind,cReplace)
>> FWRITE(m.lhOut, lcBufferOut)
>>ENDDO
>>FCLOSE(m.lhIn)
>>FCLOSE(m.lhOut)
>>
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform