On Mon, Feb 7, 2011 at 10:25 AM, Noon Silk <[email protected]> wrote: > On Mon, Feb 7, 2011 at 10:21 AM, Bec Carter <[email protected]> wrote: >> Good mornin' all! >> >> I've a requirement to put certain values (after computing them) in >> various spots in a very large text file. So basically the starting >> text file can have placeholders where these computed values will end >> up- like a template. Then my code will compute some values based on >> user input and i need to fill in the placeholders. >> >> Is there a better way to do this besides a simple string replace? > > Well, no. You'll need to read the file in and find your tokens and > replace them. Depending on how large the file it, you might need to do > this line by line, or chunk by chunk, writing out as you read in, but > inevitably it comes down to looking for a sequence and replacing it > with another. > > How large is "very large"? Megs? Gigs? >
Yup reading all into a string right now and replacing. File is around 750 megs > >> Cheers. >> Bec > > -- > Noon Silk > > http://dnoondt.wordpress.com/ (Noon Silk) | http://www.mirios.com.au:8081 > > > Fancy a quantum lunch? > http://www.mirios.com.au:8081/index.php?title=Quantum_Lunch > > "Every morning when I wake up, I experience an exquisite joy — the joy > of being this signature." >
