the_train_man wrote:
> On Oct 22, 10:32 am, [EMAIL PROTECTED] (Dr.Ruud) wrote:
>   
>> [EMAIL PROTECTED] schreef:
>>
>>     
>>> I would like to replace a part of a really big (4GB) text file. And
>>> the contents that I want to change is really a small but continuous
>>> portion. Could some one please help me with the best way I can do this
>>> in perl?
>>>       
>> Is the replacement guaranteed to be the same size as the original?
>>
>> --
>> Affijn, Ruud
>>
>> "Gewoon is een tijger."
>>     
>
> Thanks for your suggestion.
>
> No, the resulting file may be different in file length.
>
> To be more specific,
>
> Consider the file contents as:
>
> A
> B
> C
> D
> E
> F
> G
> H
>
> and I want to replace the lines 2-4 which may result in a file being
>
> A
> X
> Y
> Z
> D
> E
> F
> G
> H
>
> the problem that I am facing is the time it takes to write out the
> line 5 to end of file in cases where the file size run into GBs.
>
> Is there a way I can cat the contents from D to H to the modified top
> portion?
>
> Thanks,
>
>
>   
If you're on a *NIX then initially use "split".  Modify the relevant
file, and then you can just use cat old_end >> new_start.  Otherwise
there are similar utilities for other platforms (I think hjsplit should
work for windows). 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to