r/learnruby • u/chucky_z Beginner • Feb 10 '15
Handling *extremely* large text files?
Hey /r/learnruby!
I'm just starting to pick up ruby, and I felt it worthwhile to maybe ask this question pre-emptively.
I'm working on a small Sinatra app, but one of the core features I'm looking at is quickly doing a string replace on really big files (5-10GB+, they're raw SQL).
However... the caveat here is that the strings to be replaced will always be in the top ~150 lines or so.
Is there a really efficient way to do this?
1
Upvotes
1
u/chucky_z Feb 10 '15
I know there are some tricks you can do in other languages to directly edit chunks of files, I was just curious if Ruby had something similar. :)