Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Manipulations on the huge text file
Message
 
 
To
28/04/2000 16:48:36
Oleg Khvalin
The Sutherland Group Ltd
Rochester, New York, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00364631
Message ID:
00364713
Views:
34
Hi Oleg,

Finally I used your suggestion. It takes ~ 2 min. on the server and about 5-6 min. on my workstation on the 35MB file, so it's not too bad. My manager told me, that it's OK.

BTW, in DO WHILE should be !FEOF.

We don't know, that's the threshhold, so I just use an assumption, that it's 5MB.

Thank you for your help.




>>>Hi everyone,
>>>
>>>I have a huge text file (~100 000 records with ~50-60 fields), Tab delimited. I need to remove all double quotations from this file.
>>>
>>>This is the algorithm, we used. It doesn't work on big files - we have an error: "String is too big to fit".
>>>
>>>What else could you suggest besides low-level functions?
>>>
>>>
>>>lntxtfiles=adir(laTxtFiles, lcPattern) && Retrieve list of text files
>>>
>>>*--------------------------------------------------------------------------
>>>* -- loop through the array and perform string transformations in each text file
>>>*--------------------------------------------------------------------------
>>>create cursor lcTempCursor ;
>>>                (WorkField M)
>>>append blank
>>>
>>>for i=1 to lnTxtFiles
>>>    lcFileName=lcPath+laTxtFiles[i,1]
>>>    lcSendFileName = lcPath+ojc.CurState+'\'+left(laTxtFiles[i,1],4)+'.txt'
>>>    if file(lcSendFileName)
>>>        erase (lcSendFileName)
>>>    endif
>>>        append memo WorkField from (lcFileName) overwrite
>>>     if !empty(alltrim(WorkField))
>>>          replace WorkField with strtran(WorkField,'"','')
>>>          copy memo WorkField to (lcSendFileName)
>>>     endif
>>>next
>>
>>Nadya,
>>for large files I'd use FOPEN - FGETS - FPUTS
>>something like this:
>>inFile= FOPEN(lcFileName)
>>outFile=FCREATE(lcSendFileName)
>>DO WHILE FEOF(inFile)
>> lcBuffer=FGETS(inFile,1000)
>> lcBuffer= strtran (lcBuffer,'"','')
>> =FPUTS(outFile,lcBuffer)
>>ENDDO
>>close all
>>
>>HTH
>>Oleg
>
>PS buffer size should be > than record size
>Oleg
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform