Delete lines in files (text files)

Joe Lewis Wilkins pepetoo at cox.net
Fri Jan 18 02:02:20 EST 2008


Till,

Sounds to me as if you need to make some better arrangements; file- 
size-wise that is. You are in control of the situation; are you not?

Joe Wilkins

On Jan 17, 2008, at 10:22 PM, Till Bandi wrote:

> I guess that would be a good solution - my only problem is that the  
> file has 5.6 Gigabytes. So I can't put it all in memory.
>
> My real problem is here:
>
>     put 1 into vStartwert
>     set the cursor to watch
>     open file tFileIn
>     open file tFileOut
>
>     repeat forever
>         read from file tFileIn at vStartwert for 1000000 lines
>         put it into vChunk
>         replace ";" with tab in vChunk
>         replace "," with "." in vChunk
>         write vChunk to  file vFileOut at end
>         add number of chars of vChunk to vStartwert
>     end repeat
>     close file tFileIn
>     close file tFileOut
>
> This works until the output file reaches 2 Gigabytes. So I think  
> vStartwert is getting to big and doesn't work anymore. Therefore I  
> wanted to delete
> the Lines I already treated in the input file so I could always  
> start at the first line.
>
> Maybe there is a better solution?
>
> Till
>
> Am 17.01.2008 um 20:25 schrieb Devin Asay:
>
>>
>> On Jan 17, 2008, at 12:05 PM, Till Bandi wrote:
>>
>>> Hi all
>>>
>>> is there a way to delete lines in a text file from Revoution? - i  
>>> did not see how this can be done but probably it is very simple.
>>
>> Till,
>>
>> You have to read it in then write it back out. You can do it in  
>> one line like this (assume you want to delete the first line):
>>
>> put line 2 to -1 of url "file:/path/to/file.txt" into url "file:/ 
>> path/to/file.txt"
>>
>> Just modify the range of lines you want to have in the final file.
>>
>> HTH
>>
>> Devin
>>
>> Devin Asay
>> Humanities Technology and Research Support Center
>> Brigham Young University
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list